时间:2021-07-01 10:21:17 帮助过:21人阅读
php去掉数组最后一个元素的方法:首先创建一个PHP示例文件;然后定义一个数组;最后通过“array_pop($test_arr)”方法删除数组中的最后一个元素即可。

本文操作环境:windows7系统、PHP7.1版,DELL G3电脑
array_pop()函数
删除数组中的最后一个元素。如果数组为空则返回null。
示例:
<?php
$test_arr = array (
"name" => "jeanphorn",
"skill" => "programming",
"hobby" => "swimming",
);
echo array_pop($test_arr). "\n";
print_r($test_arr);
?>【推荐学习:《PHP视频教程》】
以上就是php去掉数组最后一个元素的详细内容,更多请关注gxlcms其它相关文章!