3v4l.org

run code in 200+ 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 7.0.0 - 7.4.4
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) }
Output for 5.4.0 - 5.6.40
array(17) { ["k13"]=> int(0) ["k12"]=> int(0) ["k11"]=> int(0) ["k14"]=> int(0) ["k15"]=> int(0) ["k17"]=> int(0) ["k16"]=> int(0) ["k10"]=> int(0) ["k9"]=> int(0) ["k4"]=> int(0) ["k3"]=> int(0) ["k1"]=> int(0) ["k6"]=> int(0) ["k8"]=> int(0) ["k2"]=> int(1) ["k5"]=> int(3) ["k7"]=> int(4) }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/bpvq1 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/bpvq1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bpvq1 on line 3
Process exited with code 255.