Page 1 of 1

Read an array in reverse

Posted: Tue Oct 25, 2005 6:21 pm
by Luke
What is the best way to read an array in reverse (as apposed to just foreach(This as that) {bla})

I need to do a news post administration thinger and the news needs to come up in the reverse order it went in... I will pull it out of a database in an array, but I want to read that array from the end instead of the beginning.

NEVERMIND... I found it

I'm an idiot... array_reverse() :)

Posted: Tue Oct 25, 2005 6:59 pm
by Chris Corbyn
Why not just pull it out of the database in reverse?

Code: Select all

order by date_field desc

Posted: Tue Oct 25, 2005 7:23 pm
by Luke
Yeah, that would work better.