Sort an Object Array in PHP

This gives me a brain ache every time and I always forget what project I used it in last so here it is. Still don’t quite understand why php cant just have a built in more readable function.

[code]

//$adverts is our object array

usort($adverts, function($a, $b)
{
return ($a->price < $b->price);
});
[/code]