Sort array of objects in PHP
// Typical method
function cmp($a, $b)
{
return strcmp($a->name, $b->name);
}
usort($your_data, "cmp");
// For PHP 5.3+ (using closures)
usort($your_data, function($a, $b){
return strcmp($a->name, $b->name);
});