Doing something in few lines of code is not an absolute good, just like writing very short variable names saves you time in the short run, but rears it's ugly head when you actually try to decipher your own code at a later stage. What I was outlining was a solution which would simplify the separation of code/data and presentation, this is one of the major challenges when writing larger PHP applications, and a nicely structured application is an elegant application.
I'm well aware that doing any sort of sort in PHP would be a waste of resources, but remember, this is why I'm using the associative array. I don't know how fast associative arrays are, so I can't say how bad my first solution is compared to my implementation of your and Clint's pseudo code, but I'm quite sure the difference is minimal for small cases (and you don't want to print out more than a few thousand records to one single page at most anyway).
So, to sum up. Always go for neatly organized code, separating data and presentation and building an application consisting of reusable and low-maintenance parts, then optimize time-critical parts of the system if needed, this is what you learn from Software engineering, and for a good reason -- it's an efficient way to work.