PHP.nl

array_pop

array_pop

Pop the element off the end of array

mixed **array_pop** array $array
pops and returns the value of

the last element of , shortening the by one element. array_pop``array``array

arrayThe array to get the value from.

Returns the value of the last element of . If is empty, null will be returned. array``array

Voorbeeld: example

<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_pop($stack);
print_r($stack);
?>
 After this,  will have only 3 elements:
`$stack`
Array
(
    [0] => orange
    [1] => banana
    [2] => apple
)
 and  will be assigned to
 .
`raspberry``$fruit`

array_push``array_shift``array_unshift