Home >>PHP Array Functions >PHP array_pop() Function
PHP array_pop() Function The PHP array_pop() Function is generally known for its characteristic to delete the last element of an array. This function usually returns Null, for an empty array.
Please note that this function in PHP will reset () the array pointer of the input array after its being used.
Syntax:
array_pop(array)
Parameter | Description |
---|---|
array | This is generally used to specify an array in the code, it is a mandatory parameter. |
Here, is an example of array_pop() Function in PHP:
<html> <body> <?php $g=array("blue","white","green"); array_pop($g); print_r($g); ?> </body> </html>
Array ( [0] => blue [1] => white )
Example 2:
<html> <body> <?php $arya= array('seo','php','sql','.net'); array_pop($arya); print_r($arya); ?> </body> </html>
Array ( [0] => seo [1] => php [2] => sql )