3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lap($func) { $t0 = microtime(1); $numbers = range(0, 1000000); $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.4.10.0360.04762.52
7.4.00.0390.04462.40
7.3.130.0440.03362.38
7.3.120.0490.02562.34
7.3.110.0400.03162.42
7.3.100.0370.02962.29
7.3.90.0420.02862.37
7.3.80.0300.03062.38
7.3.70.0310.03162.27
7.3.60.0320.03362.24
7.3.50.0280.03162.32
7.3.40.0300.02362.13
7.3.30.0270.03262.34
7.3.20.0250.02866.19
7.3.10.0270.02566.39
7.3.00.0330.03166.38
7.2.260.0510.03362.69
7.2.250.0330.05262.68
7.2.240.0290.02962.61
7.2.230.0290.03662.22
7.2.220.0320.03362.60
7.2.210.0230.03362.73
7.2.200.0330.04062.47
7.2.190.0380.03562.67
7.2.180.0360.02662.64
7.2.170.0280.02662.50
7.2.160.0300.02662.39
7.2.150.0370.02366.77
7.2.140.0170.02566.63
7.2.130.0280.03366.55
7.2.120.0400.03766.58
7.2.110.0280.02666.56
7.2.100.0340.03166.80
7.2.90.0410.03566.65
7.2.80.0360.02666.79
7.2.70.0570.03166.83
7.2.60.0760.03666.72
7.2.50.0690.03466.58
7.2.40.0810.02666.75
7.2.30.0480.03766.77
7.2.20.0680.02966.62
7.2.10.1870.02766.62
7.2.00.0670.02467.22
7.1.330.0240.02765.71
7.1.320.0110.05365.72
7.1.310.0150.03665.71
7.1.300.0230.04465.64
7.1.290.0110.03665.51
7.1.280.0050.04465.53
7.1.270.0120.04865.62
7.1.260.0130.03965.71
7.1.250.0330.04165.70
7.1.240.0220.04265.63
7.1.230.0180.04165.67
7.1.220.0190.03465.61
7.1.210.0170.04065.58
7.1.200.0050.05365.79
7.1.190.0100.03965.68
7.1.180.0150.04565.56
7.1.170.0070.04665.56
7.1.160.0120.04065.57
7.1.150.0210.03765.63
7.1.140.0150.04265.59
7.1.130.0140.04365.60
7.1.120.0160.04365.67
7.1.110.0190.04465.68
7.1.100.0110.05065.62
7.1.90.0190.04265.57
7.1.80.0160.04365.74
7.1.70.0590.03365.82
7.1.60.0150.04666.14
7.1.50.0280.04766.08
7.1.40.0240.04565.71
7.1.30.0220.04565.49
7.1.20.0220.04265.47
7.1.10.0260.04965.81
7.1.00.0200.05867.66
7.0.330.0270.04065.17
7.0.320.0150.03665.29
7.0.310.0170.03765.23
7.0.300.0500.04065.36
7.0.290.0210.04165.18
7.0.280.0140.03965.29
7.0.270.0180.03765.42
7.0.260.0150.04765.02
7.0.250.0130.03565.15
7.0.240.0200.03865.29
7.0.230.0100.04565.24
7.0.220.0200.03965.18
7.0.210.0230.03265.31
7.0.200.2890.04265.02
7.0.190.0200.03765.31
7.0.180.0150.04765.40
7.0.170.0890.04865.41
7.0.160.0160.05065.27
7.0.150.0090.05365.26
7.0.140.1110.06167.61
7.0.130.0220.04365.12
7.0.120.0180.04965.44
7.0.110.0150.05365.21
7.0.100.0780.04665.26
7.0.90.0280.03865.26
7.0.80.0190.04665.38
7.0.70.0300.05867.44
7.0.60.0250.06167.30
7.0.50.0220.06267.57
7.0.40.0200.06465.38
7.0.30.0170.05861.62
7.0.20.0170.05465.60
7.0.10.0180.05665.55
7.0.00.0250.04065.60
5.6.400.0370.03979.11
5.6.390.0280.05879.11
5.6.380.0280.05779.18
5.6.370.0350.05178.94
5.6.360.0360.04678.71
5.6.350.0340.04779.03
5.6.340.0300.04879.14
5.6.330.0400.03879.00
5.6.320.0280.04879.31
5.6.310.0330.04479.12
5.6.300.0390.05478.96
5.6.290.0450.04578.88
5.6.280.0380.06781.26
5.6.270.0390.05479.16
5.6.260.0490.04479.14
5.6.250.0420.05379.13
5.6.240.0420.05878.94
5.6.230.0410.05479.11
5.6.220.0450.07481.23
5.6.210.0340.08481.06
5.6.200.0450.07881.17
5.6.190.0420.07481.24
5.6.180.0470.07181.06
5.6.170.0360.06381.18
5.6.160.0390.05981.27
5.6.150.0400.06381.25
5.6.140.0390.05581.12
5.6.130.0370.05381.22
5.6.120.0350.08481.22
5.6.110.0430.07281.09
5.6.100.0420.05881.10
5.6.90.0330.08981.04
5.6.80.0310.08280.97
5.6.70.0380.06080.91
5.6.60.0440.08180.99
5.6.50.0400.07481.06
5.6.40.0450.07880.83
5.6.30.0390.06780.79
5.6.20.0350.05980.94
5.6.10.0420.08281.00
5.6.00.0400.08281.00
5.5.380.0470.05478.93
5.5.370.0460.04778.79
5.5.360.0380.08180.94
5.5.350.0510.07280.92
5.5.340.0390.07280.98
5.5.330.0410.06481.14
5.5.320.0330.08981.13
5.5.310.0380.07181.05
5.5.300.0320.06181.34
5.5.290.0450.06381.07
5.5.280.0500.07781.06
5.5.270.0340.08381.02
5.5.260.0340.07681.12
5.5.250.0380.08880.98
5.5.240.0400.05980.87
5.5.230.0470.07580.77
5.5.220.0460.08180.76
5.5.210.0400.08180.85
5.5.200.0410.07480.73
5.5.190.0400.07480.77
5.5.180.0550.06180.96
5.5.170.0440.06079.03
5.5.160.0400.07180.86
5.5.150.0380.08880.80
5.5.140.0380.08380.93
5.5.130.0410.06980.82
5.5.120.0360.08480.79
5.5.110.0450.07780.77
5.5.100.0390.07080.94
5.5.90.0390.07680.87
5.5.80.0350.07580.72
5.5.70.0310.07780.80
5.5.60.0400.06980.83
5.5.50.0430.07980.78
5.5.40.0480.06580.94
5.5.30.0380.08580.83
5.5.20.0340.07580.78
5.5.10.0380.08280.68
5.5.00.0450.07580.96
5.4.450.0450.06878.30
5.4.440.0530.05478.44
5.4.430.0420.05978.26
5.4.420.0390.06678.35
5.4.410.0270.07678.31
5.4.400.0310.06878.21
5.4.390.0390.05878.19
5.4.380.0370.07478.35
5.4.370.0350.07578.23
5.4.360.0340.06578.15
5.4.350.0310.06078.17
5.4.340.0340.06878.18
5.4.330.0330.05575.66
5.4.320.0360.07578.20
5.4.310.0420.06678.21
5.4.300.0420.06378.36
5.4.290.0340.07178.25
5.4.280.0310.07578.23
5.4.270.0290.07078.29
5.4.260.0320.07578.14
5.4.250.0400.05578.42
5.4.240.0350.06678.26
5.4.230.0360.06678.23
5.4.220.0320.06078.34
5.4.210.0430.06678.24
5.4.200.0340.06778.18
5.4.190.0380.06978.18
5.4.180.0520.06578.07
5.4.170.0410.06978.28
5.4.160.0370.07078.27
5.4.150.0400.06878.28
5.4.140.0370.07677.39
5.4.130.0310.07777.34
5.4.120.0370.05977.47
5.4.110.0390.07577.29
5.4.100.0400.06777.49
5.4.90.0350.08077.33
5.4.80.0330.07277.28
5.4.70.0330.07477.43
5.4.60.0410.06777.40
5.4.50.0400.05877.47
5.4.40.0330.06777.31
5.4.30.0390.07977.26
5.4.20.0280.08077.36
5.4.10.0400.07377.32
5.4.00.0350.07477.05
5.3.290.0370.12077.91
5.3.280.0200.11777.86
5.3.270.0300.11377.83
5.3.260.0330.11377.72
5.3.250.0430.11077.71
5.3.240.0170.11378.51
5.3.230.0300.07777.71
5.3.220.0300.12377.84
5.3.210.0230.09377.64
5.3.200.0330.11377.88
5.3.190.0300.10777.79
5.3.180.0330.10377.79
5.3.170.0200.12377.68
5.3.160.0300.11777.82
5.3.150.0330.11377.67
5.3.140.0270.12077.76
5.3.130.0400.11377.84
5.3.120.0230.11078.45
5.3.110.0400.10077.75
5.3.100.0370.10377.30
5.3.90.0270.13077.22
5.3.80.0300.10777.13
5.3.70.0270.09377.21
5.3.60.0430.09377.14
5.3.50.0270.11777.20
5.3.40.0130.11377.10
5.3.30.0370.09777.14
5.3.20.0230.06076.92
5.3.10.0170.05376.76
5.3.00.0130.06776.71
5.2.170.0030.05711.06
5.2.160.0070.05311.07
5.2.150.0000.05311.16
5.2.140.0000.03011.16
5.2.130.0000.03011.13
5.2.120.0000.03011.17
5.2.110.0000.03011.13
5.2.100.0000.02311.21
5.2.90.0000.02311.12
5.2.80.0030.04011.21
5.2.70.0070.01711.02
5.2.60.0000.03010.96
5.2.50.0100.02311.16
5.2.40.0000.02311.07
5.2.30.0000.02311.13
5.2.20.0030.03311.02
5.2.10.0030.03310.73
5.2.00.0030.02710.74
5.1.60.0000.02010.05
5.1.50.0000.02310.08
5.1.40.0000.0209.98
5.1.30.0030.02010.41
5.1.20.0000.02310.22
5.1.10.0000.02710.18
5.1.00.0070.02310.20
5.0.50.0070.0139.57
5.0.40.0030.0139.57
5.0.30.0000.0309.57
5.0.20.0000.0209.57
5.0.10.0030.0139.57
5.0.00.0030.0279.57
4.4.90.0030.0109.57
4.4.80.0000.0179.57
4.4.70.0000.0139.57
4.4.60.0000.0139.57
4.4.50.0000.0139.57
4.4.40.0000.0279.57
4.4.30.0000.0139.57
4.4.20.0000.0309.57
4.4.10.0000.0139.57
4.4.00.0000.0209.57
4.3.110.0000.0139.57
4.3.100.0030.0139.57
4.3.90.0030.0139.57
4.3.80.0070.0139.57
4.3.70.0030.0139.57
4.3.60.0000.0139.57
4.3.50.0000.0139.57
4.3.40.0000.0509.57
4.3.30.0000.0309.57
4.3.20.0000.0139.57
4.3.10.0000.0179.57
4.3.00.0000.0139.57

preferences:
35.59 ms | 401 KiB | 5 Q