English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP array_pop() Function Pops the Last Unit of the Array (Pops)
array_pop($array);
This function pops and returns the last unit of the array, and reduces the length of the array array.1.
Serial Number | Parameters and Description |
---|---|
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 Usage Example 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