function cmp($a, $b) { return strcmp($a->name, $b->name); } usort($your_data, "cmp");
Or the shorter version using closures:
usort($your_data, function($a, $b) { return strcmp($a->name, $b->name); });
Ref : http://php.net/manual/en/function.usort.php
http://stackoverflow.com/questions/4282413/php-sort-array-of-objects-by-object-fields
0 Comments.