September 2001
Intermediate to advanced
768 pages
32h 45m
English
mixed array_pop(array array) Returns and deletes the last element of an array.
Returns:
Last element of the given array; NULL on failure or if the array is empty
Description:
array_pop() returns the last value of array and deletes that element from the array. This also works for multidimensional arrays, so if the last element happens to be an array, that array is returned and deleted from array .
This function can be used with array_push() to treat arrays as stacks.
Warning:
This function directly alters the array passed to it.
Version:
PHP 4
See also:
array_push() array_shift() array_unshift()
Example:
$a1 = array('one', 'two', 'three', 'four'); $a2 = array('jan' => '01', 'feb' => '02', 'mar' ... |
Read now
Unlock full access