3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lap($func) { $t0 = microtime(1); $numbers = range(0, 10000); $ret = $func($numbers); $t1 = microtime(1); return array($t1 - $t0, $ret); } function useArray($numbers) { $result = array(); foreach ($numbers as $number) { $result[] = $number * 10; } return $result; } function useMapClosure($numbers) { return array_map(function($number) { return $number * 10; }, $numbers); } function _tenTimes($number) { return $number * 10; } function useMapNamed($numbers) { return array_map('_tenTimes', $numbers); } foreach (array('Array', 'MapClosure', 'MapNamed') as $callback) { list($delay,) = lap("use$callback"); echo "$callback: $delay\n"; }

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)
7.3.10.0040.01116.51
7.3.00.0060.00616.55
7.2.130.0040.01417.03
7.2.120.0070.00716.88
7.2.110.0070.01017.02
7.2.100.0060.00816.81
7.2.90.0040.00716.85
7.2.80.0000.01217.01
7.2.70.0030.01316.99
7.2.60.0050.00516.96
7.2.50.0000.01316.95
7.2.40.0080.00316.77
7.2.30.0060.00616.73
7.2.20.0000.01516.98
7.2.10.0090.00617.07
7.2.00.0030.01218.29
7.1.250.0040.00815.71
7.1.70.0040.00717.22
7.1.60.0070.01819.32
7.1.50.0060.01617.08
7.1.00.0100.07022.48
7.0.200.0000.01716.79
7.0.140.0100.07022.11
7.0.80.0100.06320.65
7.0.70.0100.07320.52
7.0.60.0170.08020.59
7.0.50.0130.08720.93
7.0.40.0130.07720.18
7.0.30.0170.07320.15
7.0.20.0130.04720.13
7.0.10.0030.08720.14
7.0.00.0070.08720.14
5.6.280.0070.09024.80
5.6.230.0170.10024.40
5.6.220.0230.08724.21
5.6.210.0270.08724.30
5.6.200.0100.09024.69
5.6.190.0170.09724.76
5.6.180.0070.10324.77
5.6.170.0100.10324.80
5.6.160.0100.09324.80
5.6.150.0030.10324.64
5.6.140.0030.10324.83
5.6.130.0070.09724.83
5.6.120.0000.07724.66
5.6.110.0170.09024.75
5.6.100.0070.10024.74
5.6.90.0130.09024.87
5.6.80.0200.08024.02
5.6.70.0030.09324.18
5.6.60.0130.08324.09
5.6.50.0130.09024.14
5.6.40.0070.09323.94
5.6.30.0100.09324.03
5.6.20.0170.08724.23
5.6.10.0130.07324.15
5.6.00.0170.09024.02
5.5.370.0130.06024.09
5.5.360.0270.07324.27
5.5.350.0130.08324.18
5.5.340.0170.08324.61
5.5.330.0130.08724.55
5.5.320.0200.07324.36
5.5.310.0130.09324.59
5.5.300.0130.08724.58
5.5.290.0070.10024.50
5.5.280.0170.07724.62
5.5.270.0170.09724.55
5.5.260.0070.06724.63
5.5.250.0030.06724.34
5.5.240.0130.09724.00
5.5.230.0200.07323.71
5.5.220.0130.08724.00
5.5.210.0200.07724.03
5.5.200.0130.07323.88
5.5.190.0130.09723.89
5.5.180.0100.06723.84
5.5.160.0170.08723.80
5.5.150.0100.08323.96
5.5.140.0070.05323.89
5.5.130.0070.06023.71
5.5.120.0100.05023.98
5.5.110.0070.05323.97
5.5.100.0030.05023.79
5.5.90.0030.05023.66
5.5.80.0130.04023.85
5.5.70.0070.05723.78
5.5.60.0070.05023.88
5.5.50.0070.03723.87
5.5.40.0030.07723.68
5.5.30.0070.04723.87
5.5.20.0070.04723.81
5.5.10.0100.04323.79
5.5.00.0100.04323.83
5.4.450.0030.10322.86
5.4.440.0070.10023.01
5.4.430.0230.07722.83
5.4.420.0170.08322.88
5.4.410.0170.04722.96
5.4.400.0170.09022.84
5.4.390.0100.04722.75
5.4.380.0170.08722.77
5.4.370.0130.09722.61
5.4.360.0100.09022.77
5.4.350.0030.09322.77
5.4.340.0170.07722.60
5.4.320.0170.09022.71
5.4.310.0100.08722.55
5.4.300.0100.06022.69
5.4.290.0070.04722.54
5.4.280.0130.04322.50
5.4.270.0070.04722.75
5.4.260.0100.05322.68
5.4.250.0070.04322.68
5.4.240.0100.04322.71
5.4.230.0070.04722.60
5.4.220.0070.04722.64
5.4.210.0070.04722.65
5.4.200.0030.04022.55
5.4.190.0100.04322.67
5.4.180.0070.03722.71
5.4.170.0030.06022.50
5.4.160.0070.04722.63
5.4.150.0070.04722.75
5.4.140.0030.04719.99
5.4.130.0100.08320.11
5.4.120.0000.05020.05
5.4.110.0030.04720.13
5.4.100.0070.04320.03
5.4.90.0030.04720.16
5.4.80.0030.06020.00
5.4.70.0000.05020.13
5.4.60.0170.03320.00
5.4.50.0070.08720.16
5.4.40.0170.07319.99
5.4.30.0200.06020.00
5.4.20.0070.09320.04
5.4.10.0100.05719.84
5.4.00.0100.09319.60
5.3.290.0170.08718.21
5.3.280.0070.04718.12
5.3.270.0030.04718.00
5.3.260.0070.04718.13
5.3.250.0030.05018.17
5.3.240.0030.05017.96
5.3.230.0070.04718.11
5.3.220.0030.05318.09
5.3.210.0000.05317.94
5.3.200.0030.06018.09
5.3.190.0030.05718.09
5.3.180.0100.04018.48
5.3.170.0070.04718.05
5.3.160.0100.06318.03
5.3.150.0070.06318.09
5.3.140.0200.06318.07
5.3.130.0100.09017.97
5.3.120.0100.09317.89
5.3.110.0130.09318.14
5.3.100.0070.09717.42
5.3.90.0170.09017.41
5.3.80.0000.06317.33
5.3.70.0130.09717.40
5.3.60.0030.09317.52
5.3.50.0100.09017.43
5.3.40.0070.06017.43
5.3.30.0030.10017.38
5.3.20.0030.08717.18
5.3.10.0130.06017.11
5.3.00.0000.06717.17
5.2.170.0070.07011.64
5.2.160.0030.06011.64
5.2.150.0070.04311.64
5.2.140.0000.06311.64
5.2.130.0000.06711.64
5.2.120.0130.05311.64
5.2.110.0030.06311.64
5.2.100.0130.05711.64
5.2.90.0000.05711.64
5.2.80.0030.06011.64
5.2.70.0000.05011.64
5.2.60.0070.05711.64
5.2.50.0030.05711.64
5.2.40.0100.06011.64
5.2.30.0070.05311.64
5.2.20.0030.03711.64
5.2.10.0070.05711.64
5.2.00.0100.05311.64
5.1.60.0070.05011.64
5.1.50.0070.04711.64
5.1.40.0030.05711.64
5.1.30.0030.05711.64
5.1.20.0030.04311.64
5.1.10.0030.06011.64
5.1.00.0100.04711.64
5.0.50.0070.04311.64
5.0.40.0070.04011.64
5.0.30.0100.04711.64
5.0.20.0070.03711.64
5.0.10.0030.04711.64
5.0.00.0030.06311.64
4.4.90.0030.03011.64
4.4.80.0130.02711.64
4.4.70.0030.03311.64
4.4.60.0000.02311.64
4.4.50.0070.03311.64
4.4.40.0000.06311.64
4.4.30.0030.03711.64
4.4.20.0070.03711.64
4.4.10.0030.03711.64
4.4.00.0000.03711.64
4.3.110.0030.03311.64
4.3.100.0000.02711.64
4.3.90.0000.03711.64
4.3.80.0000.05311.64
4.3.70.0070.03011.64
4.3.60.0000.02311.64
4.3.50.0030.03311.64
4.3.40.0070.03311.64
4.3.30.0000.03711.64
4.3.20.0000.03011.64
4.3.10.0030.03711.64
4.3.00.0030.03011.64

preferences:
34.24 ms | 400 KiB | 5 Q