Sort array by key (human order)

function natksort(&$array) {
    $keys = array_keys($array);
    natcasesort($keys);
    if (is_array($keys) && count($keys)) {
        foreach ($keys as $k) {
            $new_array[$k] = $array[$k];
        }
    }
    $array = $new_array;
    return true;
}
Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp