The PHP array_pop function pops the last cell of the array (out of the stack), which deletes the last element of the array. This article through the PHP example to explain the use of Array_pop function method.
array_pop-the last cell of the array (out of stack)
Description
Mixed Array_pop (array & $array)
Array_pop () pops up and returns the last cell of the array, minus one of the array lengths. If the array is empty (or not an array), it returns NULL. In addition, a Warning is generated if the call is not a number.
Note: the (reset ()) array pointer is reset when this function is used.
Parameter introduction
Parameters |
Description |
Array |
Necessary. An array of stacks needs to be made. |
return value
Returns the last value of an array. If the array is empty (if not an array), NULL will be returned.
Instance:
<?php
$stack = Array ("Orange", "banana", "apple", "raspberry");
$fruit = Array_pop ($stack);
Print_r ($stack);
? >
After this operation, the $stack will have only 3 units:
Array
(
[0] => Orange
[1] => banana
[2] => Apple
)
Thank you for reading, I hope to help you, thank you for your support for this site!