3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar1 = []; $ar1[3] = 4; $ar1[2] = 3; $ar1[5] = 6; echo json_encode($ar1) . PHP_EOL; $ar2 = array_fill_keys(range(0, 9), null); $ar2[3] = 4; $ar2[2] = 3; $ar2[5] = 6; echo json_encode($ar2) . PHP_EOL; $ar3 = new \SplFixedArray(10); $ar3[3] = 4; $ar3[2] = 3; $ar3[5] = 6; echo json_encode($ar3) . PHP_EOL;

preferences:
31.23 ms | 406 KiB | 5 Q