Page 1 of 1

sorting an array

Posted: Mon Sep 08, 2008 12:42 pm
by php idiot
I have an array with objects in it.
I need to sort this array by one of the fields inside the object. (field : price)
does anyone know how to do this?

Re: sorting an array

Posted: Mon Sep 08, 2008 1:18 pm
by onion2k
Use usort() with a custom function. Example 3 on the manual page is exactly what you're after - http://uk2.php.net/usort