array_pop() pops the last cell of the array
【Function】
This function pops and returns the last element of the array and decrements the length of the array by one.
If array is empty or not an array, NULL will be returned
【Scope of use】
php4, php5.
【Use】
mixed array_pop( array &array )
Mixed is a mixed type. The function returns an array when executed correctly. If the array is empty or not an array, it will return null
【Example】
[php]
$stack = array("orange","banana","apple","raspberry");
var_dump( array_pop($stack) );
var_dump($stack);
/*
string(9) "raspberry"
array(3) {
[0]=>
string(6) "orange"
[1]=>
string(6) "banana"
[2]=>
string(5) "apple"
}
*/
Excerpted from zuodefeng’s notes