Home  >  Article  >  Backend Development  >  php-Arrays function-array_pop-pop the last cell of the array_PHP tutorial

php-Arrays function-array_pop-pop the last cell of the array_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:51:06857browse

array_pop() pops the last cell of the array

【Function】
This function pops and returns the last element of the array and decrements the length of the array by one.
If array is empty or not an array, NULL will be returned
【Scope of use】
​​​​​ php4, php5.
【Use】
            mixed array_pop( array &array )
​​​​​ Mixed is a mixed type. The function returns an array when executed correctly. If the array is empty or not an array, it will return null
【Example】
[php]
$stack = array("orange","banana","apple","raspberry");
var_dump( array_pop($stack) );
var_dump($stack);
/*
string(9) "raspberry"
array(3) {
[0]=>
string(6) "orange"
[1]=>
string(6) "banana"
[2]=>
string(5) "apple"
}
*/


Excerpted from zuodefeng’s notes

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478219.htmlTechArticlearray_pop() Pops the last unit of the array [Function] This function will pop up and return the last unit of the array unit and decrement the length of the array by one. If array is empty or...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn