greenbandit greenbandit - 4 months ago 6
PHP Question

get last value in array

I have an array that is structured like this:

[33] => Array
(
[time] => 1285571561
[user] => test0
)

[34] => Array
(
[time] => 1285571659
[user] => test1
)

[35] => Array
(
[time] => 1285571682
[user] => test2
)


How can I get the last value in the array, but maintaining the index [35]?

The outcome that I am looking for is this:

[35] => Array
(
[time] => 1285571682
[user] => test2
)

Answer

try to use

end($array);
Comments