3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'k1' => 0, 'k2' => 1, 'k3' => 0, 'k4' => 0, 'k5' => 3, 'k6' => 0, 'k7' => 4, 'k8' => 0, 'k9' => 0, 'k10' => 0, 'k11' => 0, 'k12' => 0, 'k13' => 0, 'k14' => 0, 'k15' => 0, 'k16' => 0, 'k17' => 0, ]; asort($arr); var_dump($arr);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14
array(17) { ["k1"]=> int(0) ["k3"]=> int(0) ["k4"]=> int(0) ["k6"]=> int(0) ["k8"]=> int(0) ["k9"]=> int(0) ["k10"]=> int(0) ["k11"]=> int(0) ["k12"]=> int(0) ["k13"]=> int(0) ["k14"]=> int(0) ["k15"]=> int(0) ["k16"]=> int(0) ["k17"]=> int(0) ["k2"]=> int(1) ["k5"]=> int(3) ["k7"]=> int(4) }
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array(17) { ["k1"]=> int(0) ["k10"]=> int(0) ["k16"]=> int(0) ["k15"]=> int(0) ["k14"]=> int(0) ["k13"]=> int(0) ["k12"]=> int(0) ["k11"]=> int(0) ["k9"]=> int(0) ["k8"]=> int(0) ["k6"]=> int(0) ["k4"]=> int(0) ["k3"]=> int(0) ["k17"]=> int(0) ["k2"]=> int(1) ["k5"]=> int(3) ["k7"]=> int(4) }

preferences:
88.71 ms | 409 KiB | 5 Q