3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iters = 500; $arr = range(0, 40_000); $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = array_merge($arr, [$i => 'x']); } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = [...$arr, $i => 'x']; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr = [$i => 'x', ...$arr]; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; $t = microtime(true); foreach (range(0, $iters) as $i) { $arr[$i] = 'y'; } echo round((microtime(true) - $t) * 3, 3) . ' ms' . "\n"; var_dump(count($arr)); // dummy use of $arr variable

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.6480.48825.95
8.3.30.6670.44724.99
8.3.20.6710.47227.89
8.3.10.7340.50828.08
8.3.00.6620.44225.02
8.2.170.6370.64325.17
8.2.160.6890.56926.45
8.2.150.6490.64625.39
8.2.140.6370.62326.77
8.2.130.7000.57026.59
8.2.120.6960.56625.52
8.2.110.6720.55525.29
8.2.100.7310.54225.42
8.2.90.6610.59725.06
8.2.80.6930.57625.40
8.2.70.6910.61824.89
8.2.60.6560.60325.13
8.2.50.6890.58225.53
8.2.40.6730.56324.95
8.2.30.6390.60224.86
8.2.20.7170.51725.10
8.2.10.7190.60924.93
8.2.00.4250.48624.28
8.1.271.4760.52628.02
8.1.261.3680.63228.21
8.1.251.4520.55028.21
8.1.241.3290.67324.75
8.1.231.3720.63024.71
8.1.221.4360.56624.98
8.1.211.4230.58024.70
8.1.201.4120.59024.88
8.1.191.4530.54524.93
8.1.181.3410.65924.50
8.1.171.3730.63024.81
8.1.161.4090.59324.51
8.1.151.4250.57624.73
8.1.141.3450.66124.82
8.1.130.9510.48124.01
8.1.120.6680.50023.86
8.1.110.6780.49523.68
8.1.100.6700.47524.11
8.1.90.6440.49423.72
8.1.80.6610.45524.00
8.1.70.6720.46323.74
8.1.60.6620.45923.86
8.1.50.6350.50323.70
8.1.40.6640.46823.84
8.1.30.6560.48623.91
8.1.20.6280.50424.14
8.1.10.6690.47123.86
8.1.00.6340.49923.77
8.0.301.3960.60723.89
8.0.291.4520.55423.72
8.0.281.4690.53823.99
8.0.271.4480.55223.75
8.0.260.9020.52423.57
8.0.250.6740.50223.11
8.0.240.6830.50623.13
8.0.230.6350.50322.97
8.0.220.6260.50223.07
8.0.210.6770.47322.90
8.0.200.6520.48823.03
8.0.190.6450.51223.14
8.0.180.6570.48722.96
8.0.170.6650.48223.11
8.0.160.6560.48322.99
8.0.150.6340.50722.82
8.0.140.6250.51522.96
8.0.130.6360.50022.98
8.0.120.6500.48622.91
8.0.110.6590.50822.82
8.0.100.6610.52923.02
8.0.90.6590.49423.05
8.0.80.6360.49523.07
8.0.70.6440.48922.92
8.0.60.6380.50323.02
8.0.50.6250.51022.86
8.0.30.6560.48422.91
8.0.20.6170.50723.11
8.0.10.6880.49923.02
7.4.330.9070.50821.13
7.4.320.6750.49322.57
7.4.300.6520.47122.60
7.4.290.6290.47222.56
7.4.280.6320.46522.60
7.4.270.6260.48222.58
7.4.260.6480.45422.57
7.4.250.6510.45022.57
7.4.240.6310.47322.56
7.4.230.6490.50222.77
7.4.220.6460.48822.63
7.4.210.6270.48022.47
7.4.200.6470.45522.64
7.4.190.6380.47322.61
7.4.180.6640.43722.73
7.4.160.6550.45522.55
7.4.150.6520.45422.00
7.4.140.6570.44622.54
7.4.130.6360.48222.43
7.4.120.6580.44022.50
7.4.110.6480.46122.40
7.4.100.6730.44422.59
7.4.90.6610.44022.52
7.4.80.6560.45722.38
7.4.70.6840.54022.53
7.4.60.7390.48522.44
7.4.50.6230.50822.46
7.4.40.6620.44222.50
7.4.30.6330.46622.50
7.4.20.6050.49622.41
7.4.10.6350.47422.47
7.4.00.6740.47522.48

preferences:
26.03 ms | 403 KiB | 5 Q