public static function asort_array_of_arrays_by_key(array &$array, $key, $sortflag = core_collator::SORT_STRING) {
        $original = $array;
        foreach ($array as $initkey => $item) {
            $array[$initkey] = $item[$key];
        }
        $result = self::asort($array, $sortflag);
        self::restore_array($array, $original);
        return $result;
    }