Home  >  Article  >  php教程  >  php array_pop()数组函数将数组最后一个单元弹出(出栈)

php array_pop()数组函数将数组最后一个单元弹出(出栈)

WBOY
WBOYOriginal
2016-06-13 12:07:331267browse

复制代码 代码如下:


/*函数array_pop():将数组最后一个单元弹出(出栈)
* 1、语法:mixed array_pop ( array &array )
* 2、描述: 弹出并返回 array 数组的最后一个单元,并将数组 array 的长度减一。如果 array 为空(或者不是数组)将返回 NULL。
* 3、注意事项:
* 3.1、
*/
echo "***********************************************************************
";
$arr11=array('成绩1'=>65,'成绩2'=>25,'成绩3'=>87,'成绩4'=>85,'成绩5'=>45,'成绩6'=>66);
$arr22=array(a,b,c,d,e);
echo "数组arr11的信息:";
echo "

"; <br>print_r($arr11); <br>echo "
";
$num=count($arr11);
for($i=0;$iecho "弹出的数组的最后一个元素为:".array_pop($arr11)."
";
echo "每次弹出一个最后元素后,数组arr11的信息:";
echo "
"; <br>print_r($arr11); <br>echo "
";
echo "
";
}
?>
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