可以用end()函数取出数组的最后一个元素,
$rList = array(
array(‘id‘=>1,‘txt‘=>‘a‘),
array(‘id‘=>2,‘txt‘=>‘a‘),
array(‘id‘=>3,‘txt‘=>‘a‘),
array(‘id‘=>4,‘txt‘=>‘a‘),
);
$test = end($rList);
var_dump($test);
结果:
array(2) {
["id"]=>
int(4)
["txt"]=>
string(1) "a"
}
done!
时间: 2024-11-19 21:17:41