public static function order(array &$values, array $keys) {
    $keys = array_values($keys);

    uksort($values, function ($a, $b) use ($keys) {
      return array_search($a, $keys) - array_search($b, $keys);
    });
  }
public static function order(array &$values, array $keys) {
    $keys = array_values($keys);

    uksort($values, function ($a, $b) use ($keys) {
      return array_search($a, $keys) - array_search($b, $keys);
    });
  }
public static function order ( array & $ values , array $ keys ) { $ keys = array_values ( $ keys ) ; uksort ( $ values , function ( $ a , $ b ) use ( $ keys ) { return array_search ( $ a , $ keys ) - array_search ( $ b , $ keys ) ; } ) ; }
Puts an associative array into an arbitrary order.

@param array $values
The array to reorder.
@param array $keys
The keys, in their desired order.
Puts an associative array into an arbitrary order .