public static function arraySortUsingKeys($arrayToSort, $arrayKeysInOrder)
    {
        $result = array();
        foreach($arrayKeysInOrder as $key)
            if(array_key_exists($key, $arrayToSort))
                $result[] = $arrayToSort[$key];

        return $result;
    }
public static function arraySortUsingKeys($arrayToSort, $arrayKeysInOrder)
    {
        $result = array();
        foreach($arrayKeysInOrder as $key)
            if(array_key_exists($key, $arrayToSort))
                $result[] = $arrayToSort[$key];

        return $result;
    }
public static function arraySortUsingKeys ( $ arrayToSort , $ arrayKeysInOrder ) { $ result = array ( ) ; foreach ( $ arrayKeysInOrder as $ key ) if ( array_key_exists ( $ key , $ arrayToSort ) ) $ result [ ] = $ arrayToSort [ $ key ] ; return $ result ; }
Sorts an array using another array as a guide for key order

@param array $arrayToSort      The associative array to sort and return
@param array $arrayKeysInOrder An ordered list of keys in {@link $arrayToSort}

@return array A sorted array
Sorts an array using another array as a guide for key order