FeaturePhp/Helper/_Array.php
public static function sortByKey($_array, $key) {
        $array = $_array;
        $result = usort($array, function($a, $b) use ($key) {
            return strcmp(call_user_func(array($a, $key)),
                          call_user_func(array($b, $key)));
        });
        if (!$result)
            throw new ArrayException("sorting by \"$key\" failed");
        return $array;
    }
public static function sortByKey($_array, $key) {
        $array = $_array;
        $result = usort($array, function($a, $b) use ($key) {
            return strcmp(call_user_func(array($a, $key)),
                          call_user_func(array($b, $key)));
        });
        if (!$result)
            throw new ArrayException("sorting by \"$key\" failed");
        return $array;
    }
public static function sortByKey ( $ _array , $ key ) { $ array = $ _array ; $ result = usort ( $ array , function ( $ a , $ b ) use ( $ key ) { return strcmp ( call_user_func ( array ( $ a , $ key ) ) , call_user_func ( array ( $ b , $ key ) ) ) ; } ) ; if ( ! $ result ) throw new ArrayException ( "sorting by \"$key\" failed" ) ; return $ array ; }
Sorts an array in ascending order regarding a member.
@param array $_array
@param callable $key
@return array
Sorts an array in ascending order regarding a member .