protected static function sort(array $array, callable $callback): array
    {
        $results = [];

        foreach ($array as $key => $value) {
            $results[$key] = $callback($value, $key);
        }

        \asort($results, \SORT_REGULAR);

        foreach (\array_keys($results) as $key) {
            $results[$key] = $array[$key];
        }

        return $results;
    }
protected static function sort(array $array, callable $callback): array
    {
        $results = [];

        foreach ($array as $key => $value) {
            $results[$key] = $callback($value, $key);
        }

        \asort($results, \SORT_REGULAR);

        foreach (\array_keys($results) as $key) {
            $results[$key] = $array[$key];
        }

        return $results;
    }
protected static function sort ( array $ array , callable $ callback ) : array { $ results = [ ] ; foreach ( $ array as $ key => $ value ) { $ results [ $ key ] = $ callback ( $ value , $ key ) ; } \ asort ( $ results , \ SORT_REGULAR ) ; foreach ( \ array_keys ( $ results ) as $ key ) { $ results [ $ key ] = $ array [ $ key ] ; } return $ results ; }
Sort the array using the given callback.

@param array    $array
@param callable $callback

@return array
Sort the array using the given callback .