How can I sort this array of objects by one of its fields, like name or count ?
name
count
Array ( [0] => stdClass Object (
If everything fails here is another solution:
$names = array(); foreach ($my_array as $my_object) { $names[] = $my_object->name; //any object field } array_multisort($names, SORT_ASC, $my_array); return $my_array;