如何获取数组的最后一个值?

Below are the contents of the array. How can I get the last array, [cat_name] => Lcd?

I do not need:

[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
        )

)

You can get the last cat_name value like so:

$arr[count($arr) - 1]['cat_name']

You can retrieve the last element of the array like this: $array[count($array) - 1]

Use end().

$lastMember = end($arr);

Note that this advances the array's internal pointer, which may matter dependent on what other code you have.