How can I sort this array of objects by one of its fields, like name or count ?
name
count
Array ( [0] => stdClass Object (
if you're using php oop you might need to change to:
public static function cmp($a, $b) { return strcmp($a->name, $b->name); } //in this case FUNCTION_NAME would be cmp usort($your_data, array('YOUR_CLASS_NAME','FUNCTION_NAME'));