Remove the last element from an array:
<?php$a=array("red","green","blue");array_pop($a);print_r($a);?>The array_pop() function removes the last element from an array.
array_pop( array )
| parameter | describe |
|---|---|
| array | Required. Specifies an array. |
| Return value: | Returns the last value of the array . If the array is empty, or is not an array, NULL will be returned. |
|---|---|
| PHP version: | 4+ |