Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-06 20:37:50
Original
798 people have browsed it

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

代码如下:
/*函数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 "
Copy after login
Copy after login
";
$num=count($arr11);
for($i=0;$iecho "弹出的数组的最后一个元素为:".array_pop($arr11)."
";
echo "每次弹出一个最后元素后,数组arr11的信息:";
echo "
"; <br>print_r($arr11); <br>echo "
Copy after login
Copy after login
";
echo "
";
}
?>
Related labels:
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