PHP array_pop() Function

❮ PHP Array Reference

Example

Delete the last element of an array:

<?php
$a=array("red","green","blue");
array_pop($a);
print_r($a);
?>
Try it Yourself »

Definition and Usage

The array_pop() function deletes the last element of an array.


Syntax

array_pop(array)

Parameter Values

Parameter Description
array Required. Specifies an array

Technical Details

Return Value: Returns the last value of array. If array is empty, or is not an array, NULL will be returned.
PHP Version: 4+

❮ PHP Array Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.