public static function orderBy(array $elements, $orderField)
    {
        usort($elements, function ($a, $b) use ($orderField) {
            return $a->$orderField < $b->$orderField ? -1 : 1;
        });
        return $elements;
    }
public static function orderBy(array $elements, $orderField)
    {
        usort($elements, function ($a, $b) use ($orderField) {
            return $a->$orderField < $b->$orderField ? -1 : 1;
        });
        return $elements;
    }
public static function orderBy ( array $ elements , $ orderField ) { usort ( $ elements , function ( $ a , $ b ) use ( $ orderField ) { return $ a -> $ orderField < $ b -> $ orderField ? - 1 : 1 ; } ) ; return $ elements ; }
This method sorts elements in array using order field.

Example:
<code>
$obj1 = new stdClass();
$obj1->name = 'a';
$obj1->description = '1';

$obj2 = new stdClass();
$obj2->name = 'c';
$obj2->description = '2';

$obj3 = new stdClass();
$obj3->name = 'b';
$obj3->description = '3';

$array = array($obj1, $obj2, $obj3);
$sorted = Arrays::orderBy($array, 'name');
</code>
Result:
<code>
Array
(
[0] => stdClass Object
(
[name] => a
[description] => 1
)
[1] => stdClass Object
(
[name] => b
[description] => 3
)
[2] => stdClass Object
(
[name] => c
[description] => 2
)
)
</code>

@param array $elements
@param string $orderField
@return array
This method sorts elements in array using order field .