Delete the last element of an array:
<?php
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
Try it Yourself »
The array_pop() function deletes the last element of an array.
array_pop(
array)
Parameter | Description |
---|---|
array | Required. Specifies an array |
Return Value: | Returns the last value of array. If array is empty, or is not an array, NULL will be returned. |
---|---|
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!