PHP array_pop()Functions
Examples
Remove the last element of an array:
<?php
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
Run example »
Definition and Usage
The array_pop() function removes the last element of an array.
Syntax
array_pop(array)
| Parameter | Description |
|---|---|
| array | Required. Specifies the array. |
Technical Details
| Return value: | Returnsarray's last value. Ifarrayis empty, or not an array, NULL will be returned. |
|---|---|
| PHP Version: | 4+ |
Complete PHP Array Reference Other Extensions