下面是數組的內容。我怎樣才能得到最後一個數組,[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