<commit_before><?php

if (!function_exists('array_except_value')) {
    function array_except_value(array $array, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }

        foreach ($value as $item) {
            while (($key = array_search($item, $array, true)) !== false) {
                unset($array[$key]);
            }
        }

        return $array;
    }
}

if (!function_exists('multiarray_sort_by')) {
    function multiarray_sort_by(array $array, $field1 = null, $sort1 = null, $_ = null)
    {
        $arguments = func_get_args();

        $multiarray = array_shift($arguments);
        foreach ($arguments as $argKey => $argValue) {
            if (is_string($argValue)) {
                $column = [];
                foreach ($multiarray as $key => $item) {
                    $column[$key] = $item[$argValue];
                }
                $arguments[$argKey] = $column;
            }
        }
        $arguments[] = &$multiarray;
        call_user_func_array('array_multisort', $arguments);

        return array_pop($arguments);
    }
}
<commit_msg>IHF: `multiarray_sort_by` simplified.<commit_after><?php

if (!function_exists('array_except_value')) {
    function array_except_value(array $array, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }

        foreach ($value as $item) {
            while (($key = array_search($item, $array, true)) !== false) {
                unset($array[$key]);
            }
        }

        return $array;
    }
}

if (!function_exists('multiarray_sort_by')) {
    function multiarray_sort_by(array $array, $field1 = null, $sort1 = null, $_ = null)
    {
        $arguments = func_get_args();

        $multiarray = array_shift($arguments);
        foreach ($arguments as $argKey => $argValue) {
            if (is_string($argValue)) {
                $arguments[$argKey] = array_pluck($multiarray, $argValue);
            }
        }
        $arguments[] = &$multiarray;
        call_user_func_array('array_multisort', $arguments);

        return array_pop($arguments);
    }
}

{'fraction_non_alphanumeric': 0.1487058823529412, 'fraction_numerical': 0.0018823529411764706, 'mean_word_length': 2.085631349782293, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1247689', 'n_tokens_mistral': 646, 'n_tokens_neox': 627, 'n_words': 117}