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 |
Description |
array |
Required. Defines an array. |
Return Value: |
Returns the last value of the array. If the array is empty or not an array, |
PHP Version: |
4+ |