1、end() 获取数组的最后一个元素
<?php
$array=array("1","2","123","4a");
echo end($array);
/*返回结果:4a*/
?>
2、数组是数值型数组,利用数组的下标
<?php $array=array("a","b","c","d"); echo $array[(count($array))-2]; /*返回结果:c*/ ?>
1、end() 获取数组的最后一个元素
<?php
$array=array("1","2","123","4a");
echo end($array);
/*返回结果:4a*/
?>
2、数组是数值型数组,利用数组的下标
<?php $array=array("a","b","c","d"); echo $array[(count($array))-2]; /*返回结果:c*/ ?>
转载于:https://www.cnblogs.com/hanivy/p/8426260.html