Friday, January 4, 2013

array_pop()

array_popPop the element off the end of array

array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Will additionally produce a Warning when called on a non-array.  


<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_pop($stack);
print_r($stack);
?>
Array
(
    [0] => orange
    [1] => banana
    [2] => apple
)

No comments:

Post a Comment