下面是数组的内容。我怎样才能得到最后一个数组,[cat_name] => Lcd
?如何获取数组的最后一个值?
我不需要:
[cat_link] => lcd
[cat_id] => 172
(
[0] => Array
(
[cat_name] => Electronics
[cat_link] => electronics
[cat_id] => 164
)
[1] => Array
(
[cat_name] => Televisions
[cat_link] => televisions
[cat_id] => 165
)
[2] => Array
(
[cat_name] => Lcd
[cat_link] => lcd
[cat_id] => 172
)
)
非常感谢。我试图使用end($ arr),但没有工作 – emre 2011-12-29 02:46:28
@ baris22:PHP 5.2及更低版本有这种奇怪的怪癖,其中'''不能跟着''''。所以'end($ arr)['cat_name']'会是一个语法错误。只是FYI :) – Ryan 2011-12-29 02:49:03