php 取数组最后一个键,如何获取数组中的最后一个键?
php 取数组最后一个键,如何获取数组中的最后一个键?方法教程语法代码如下:
$lastKey = count($array)-1;案例分析:
$array = array(0=>'dog', 1=>'cat');
$lastKey = count($array)-1;
$lastKeyValue = $array[$lastKey];
var_dump($lastKey);
print_r($lastKeyValue);
页:
[1]