Copyright © tutorialspoint.com
| array_pop ( $array ); |
This function 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.
| Parameter | Description |
|---|---|
| array | Required. Specifies an array. |
It returns the last value of the array, shortening the array by one element.
Try out following example:
<?php
$array=array("a"=>"banana","b"=>"apple","c"=>"orange");
print_r(array_pop($array));
print_r("<br />");
print_r(array_pop($array));
?>
|
This will produce following result:
orange apple |
Copyright © tutorialspoint.com