PHP array_pop () function
Examples
Remove the last element in the array:
<?php
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
Running instance »
Definition and Usage
array_pop () function removes the last element in the array.
grammar
array_pop( array )
参数 | 描述 |
---|---|
array | 必需。规定数组。 |
technical details
return value: | It returns the last value of the array. If the array is empty or is not an array, it returns NULL. |
---|---|
PHP version: | 4+ |
Complete PHP Array Reference