English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP array_pop() function pops the last element of the array (pop)
array_pop($array);
This function pops and returns the last element of the array and reduces the length of the array.1.
Serial number | Parameters and descriptions |
---|---|
1 | array(Required) It specifies an array. |
It returns the last value of the array, reducing the array by one element. If the array is empty (if it is not an array), it will return NULL.
array_pop() function pops the last element, with example usage and output result
<?php $input = array("a"=>"banana","b"=>"apple","c"=>"orange"); print_r(array_pop($input)); print_r("\n"); print_r(array_pop($input)); ?>Test and see‹/›
Output result:
orange apple