3v4l.org

run code in 300+ PHP versions simultaneously
<?php function returnTime(callable $function, int $repeat = 50) { $tests = []; for ($i = 0; $i < $repeat; ++$i) { $startTime = microtime(true); $function(); $endTime = microtime(true); $tests[] = $endTime - $startTime; } // Representing the average return 1000 * array_sum($tests) / $repeat; } $array = range(0, 450000); unset($array[0]); echo "Duration of array_values: ", returnTime(function() use ($array) { $newArray = array_values($array); }); echo PHP_EOL; echo "Duration of splat-pack: " , returnTime(function() use ($array){ $newArray = [...$array]; });

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.30.1100.12235.73
8.3.20.2800.15037.79
8.2.120.2010.24335.29
8.2.110.2840.18035.88
8.2.100.2920.16435.59
8.2.90.2860.15634.19
8.2.80.2700.17034.39
8.2.70.1390.13334.35
8.2.60.3170.13534.18
8.2.50.3050.18634.25
8.2.40.3160.14134.02
8.2.30.3150.14434.33
8.2.20.3020.13434.26
8.2.10.3210.12634.39
8.2.00.3270.12534.59
8.1.240.0240.00933.60
8.1.230.0320.00634.14
8.1.220.0290.00334.00
8.1.210.0230.00835.31
8.1.200.0160.00333.90
8.1.190.0080.01333.78
8.1.180.0220.01933.96
8.1.170.0150.00333.95
8.1.160.0140.00734.03
8.1.150.0140.00436.08
8.1.140.0180.00034.01
8.1.130.0110.00834.10
8.1.120.0280.00634.02
8.1.110.0130.00733.96
8.1.100.0080.01633.91
8.1.90.0240.01433.86
8.1.80.0250.01333.94
8.1.70.0140.00534.12
8.1.60.0170.00734.14
8.1.50.0200.00334.22
8.1.40.0110.00734.32
8.1.30.0190.00034.53
8.1.20.0200.00334.27
8.1.10.5460.24350.27
8.1.00.7800.19650.45
8.0.300.7390.24049.35
8.0.290.7380.24049.39
8.0.280.6910.27449.40
8.0.270.7270.25249.34
8.0.260.7770.21149.73
8.0.250.7470.24049.50
8.0.240.7000.29049.45
8.0.230.7870.23949.62
8.0.220.7630.24849.27
8.0.210.7750.19349.45
8.0.200.7680.21049.43
8.0.190.6690.27650.08
8.0.180.7490.22349.54
8.0.170.7650.19849.59
8.0.160.7570.23749.55
8.0.150.7110.23949.69
8.0.140.7180.24549.60
8.0.130.7060.26049.83
8.0.120.7970.17949.21
8.0.110.7320.22849.29
8.0.100.7600.23149.39
8.0.90.7610.22349.64
8.0.80.7530.21949.70
8.0.70.7900.21349.39
8.0.60.7370.20750.05
8.0.50.7110.24549.57
8.0.30.7620.23550.04
8.0.20.7550.22749.71
8.0.10.7660.21149.26
8.0.00.7330.22753.40
7.4.330.8430.28844.04
7.4.320.7500.21049.14
7.4.300.7460.23849.13
7.4.290.7530.18349.32
7.4.280.7170.23049.01
7.4.270.7120.21649.16
7.4.260.7260.20449.31
7.4.250.8510.20248.90
7.4.240.9240.20549.03
7.4.230.7110.24948.86
7.4.220.6790.27348.99
7.4.210.7390.23349.05
7.4.200.7740.24048.81
7.4.190.6990.26849.00
7.4.180.7590.22149.14
7.4.160.7270.23348.95
7.4.150.7710.22748.95
7.4.140.7370.22748.80
7.4.130.7190.24349.05
7.4.120.7750.32948.07
7.4.110.9960.50147.98
7.4.100.9690.51948.08
7.4.91.0150.48548.01
7.4.81.0280.46048.03
7.4.70.8420.48447.96
7.4.60.9890.48748.13
7.4.51.0220.44048.16
7.4.40.9600.51548.16
7.4.31.1640.58947.88
7.4.21.1870.62847.79
7.4.10.9750.50048.20
7.4.00.9810.51248.04
7.3.330.0180.00619.05
7.3.320.0070.00718.91
7.3.310.0170.00317.01
7.3.300.0210.00617.00
7.3.290.0250.00817.18
7.3.280.0250.01117.16
7.3.270.0300.00417.02
7.3.260.0280.00317.09
7.3.250.0290.00317.32
7.3.240.0110.01316.74
7.3.230.0220.00716.52
7.3.220.0230.00816.57
7.3.210.0220.00816.78
7.3.200.0200.00416.66
7.3.190.0240.00616.68
7.3.180.0190.01116.58
7.3.170.0210.00716.61
7.3.160.0180.00716.54
7.3.150.0170.00816.70
7.3.140.0220.00616.82
7.3.130.0190.00716.61
7.3.120.0150.01016.74
7.3.110.0200.00616.54
7.3.100.0170.01016.60
7.3.90.0200.00516.72
7.3.80.0130.01116.08
7.3.70.0130.01015.99
7.3.60.0180.00615.99
7.3.50.0160.00516.02
7.3.40.0180.00416.00
7.3.30.0160.00816.04
7.3.20.0140.00817.30
7.3.10.0140.00717.23
7.3.00.0090.00817.13
7.2.340.0120.01017.73
7.2.330.0260.00216.62
7.2.320.0240.00316.74
7.2.310.0170.01016.60
7.2.300.0110.01716.76
7.2.290.0230.00716.66
7.2.280.0150.01116.80
7.2.270.0150.01116.76
7.2.260.0180.00616.59
7.2.250.0190.00616.78
7.2.240.0210.00716.70
7.2.230.0170.00616.72
7.2.220.0130.00816.71
7.2.210.0150.01016.14
7.2.200.0140.00616.17
7.2.190.0190.00516.09
7.2.180.0070.00816.11
7.2.170.0180.00516.01
7.2.160.0130.01016.11
7.2.150.0170.00617.94
7.2.140.0150.00917.38
7.2.130.0180.00417.41
7.2.120.0120.01117.33
7.2.110.0180.00617.37
7.2.100.0170.00717.28
7.2.90.0160.01017.32
7.2.80.0130.01217.42
7.2.70.0250.00717.29
7.2.60.0180.00817.13
7.2.50.0160.00717.36
7.2.40.0130.00917.52
7.2.30.0080.01117.33
7.2.20.0380.00617.36
7.2.10.0140.00917.63
7.2.00.0100.00817.18
7.1.330.0160.00716.67
7.1.320.0360.00916.71
7.1.310.0190.00916.40
7.1.300.0190.00516.32
7.1.290.0230.00716.18
7.1.280.0170.00916.28
7.1.270.0180.00816.12
7.1.260.0210.00316.27
7.1.250.0170.01116.13
7.1.240.0240.00716.66
7.1.230.0220.00516.63
7.1.220.0180.01316.56
7.1.210.0280.00416.56
7.1.200.0260.00916.57
7.1.190.0290.00516.52
7.1.180.0240.00816.66
7.1.170.0250.00517.21
7.1.160.0240.01016.65
7.1.150.0230.00916.70
7.1.140.0240.00916.61
7.1.130.0260.00616.58
7.1.120.0280.00716.60
7.1.110.0210.01016.50
7.1.100.0220.01216.57
7.1.90.0190.01316.63
7.1.80.0260.00716.68
7.1.70.0190.00716.45
7.1.60.0210.00316.72
7.1.50.0740.00616.66
7.1.40.0140.00916.80
7.1.30.0180.00716.63
7.1.20.0230.00916.60
7.1.10.0220.00616.61
7.1.00.0160.00816.52

preferences:
43.4 ms | 401 KiB | 5 Q