Home > php教程 > php手册 > php-Arrays函数-array_pop-将数组的最后一个单元弹出

php-Arrays函数-array_pop-将数组的最后一个单元弹出

WBOY
Release: 2016-06-13 10:49:19
Original
1683 people have browsed it

array_pop() 将数组的最后一个单元弹出

【功能】
         该函数将弹出并返回array数组的最后一个单元,并将数组array的长度减一。
         如果array为空或者不是数组将返回NULL       
【使用范围】
         php4、php5.
【使用】
         mixed array_pop( array &array )
         mixed为混合型,函数在正确执行时返回数组,如果array为空或者不是数组将返回null
【示例】
[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"
}
*/ 

 


摘自 zuodefeng的笔记

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template