3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [10 => '10 (int)', 50 => '50 (int)', 'foo' => 'foo (string)']; ksort($array, SORT_NUMERIC); print_r(array_keys($array));
Output for 8.1.5 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Array ( [0] => foo [1] => 10 [2] => 50 )

preferences:
66.35 ms | 402 KiB | 28 Q