3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* How many times the code under test should run in each function */ define('LOOP', 10); define('MAX', 10); function f1() { for ($i = 0; $i < LOOP; ++$i) { // one liner array_map with anonymous function - 5.3+ $array = array_map(function($d) { return 'count_' . $d; }, range(0, MAX)); } } function f2() { for ($i = 0; $i < LOOP; ++$i) { // another (convoluted) one line approach, avoiding array_map - 5.2+ $array = explode('#', 'count_' . implode('#count_', range(0, MAX))); } } $start = microtime(true); f1(); $stop = microtime(true); $time1 = $stop - $start; $start = microtime(true); f2(); $stop = microtime(true); $time2 = $stop - $start; echo $time1 . "\t"; echo $time2 . "\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.2.00.0140.00019.50
7.1.70.0080.00017.11
7.1.60.0090.00919.82
7.1.50.0140.01017.09
7.1.00.0070.07322.36
7.0.200.0030.00616.85
7.0.140.0000.07322.07
7.0.100.0100.04719.91
7.0.90.0100.07019.88
7.0.80.0070.05320.14
7.0.70.0200.05319.86
7.0.60.0100.04020.26
7.0.50.0100.03720.65
7.0.40.0070.03720.31
7.0.30.0130.03320.39
7.0.20.0000.04320.41
7.0.10.0030.06320.38
7.0.00.0130.05720.46
5.6.280.0100.06720.93
5.6.250.0030.04020.61
5.6.240.0100.07720.50
5.6.230.0100.07720.60
5.6.220.0100.03720.57
5.6.210.0130.05720.50
5.6.200.0030.06021.04
5.6.190.0030.04321.05
5.6.180.0100.03721.03
5.6.170.0000.04321.04
5.6.160.0070.08321.15
5.6.150.0070.08721.00
5.6.140.0070.08021.04
5.6.130.0070.08720.96
5.6.120.0100.08021.11
5.6.110.0070.07721.12
5.6.100.0100.07321.10
5.6.90.0100.08721.01
5.6.80.0170.07020.42
5.6.70.0100.08020.43
5.6.60.0070.08720.43
5.6.50.0170.07020.52
5.6.40.0030.07720.41
5.6.30.0030.08020.50
5.6.20.0070.06320.45
5.6.10.0070.08020.40
5.6.00.0130.06320.52
5.5.380.0070.03720.44
5.5.370.0030.04720.45
5.5.360.0100.03720.51
5.5.350.0130.03320.33
5.5.340.0000.04320.90
5.5.330.0130.03320.75
5.5.320.0100.03720.80
5.5.310.0030.04320.93
5.5.300.0100.07320.81
5.5.290.0130.07020.92
5.5.280.0070.08720.88
5.5.270.0070.07320.80
5.5.260.0070.08720.83
5.5.250.0070.08020.56
5.5.240.0130.08020.20
5.5.230.0030.08720.25
5.5.220.0100.04320.22
5.5.210.0030.07720.21
5.5.200.0070.07720.25
5.5.190.0070.07320.28
5.5.180.0070.07320.00
5.5.160.0130.07320.09
5.5.150.0030.08020.12
5.5.140.0170.06320.28
5.5.130.0070.08019.99
5.5.120.0070.08020.16
5.5.110.0130.06320.28
5.5.100.0100.03720.06
5.5.90.0130.07320.08
5.5.80.0070.07020.09
5.5.70.0070.08720.10
5.5.60.0000.08320.07
5.5.50.0170.07019.95
5.5.40.0100.07320.07
5.5.30.0100.05720.07
5.5.20.0100.07320.01
5.5.10.0070.08020.00
5.5.00.0100.07720.09
5.4.450.0170.07319.57
5.4.440.0070.07719.45
5.4.430.0100.07019.20
5.4.420.0030.07719.50
5.4.410.0070.07019.38
5.4.400.0100.07718.89
5.4.390.0130.07719.14
5.4.380.0100.06719.13
5.4.370.0100.07719.24
5.4.360.0130.06719.21
5.4.350.0170.06719.05
5.4.340.0070.08319.05
5.4.320.0100.07018.88
5.4.310.0100.07319.14
5.4.300.0030.08319.09
5.4.290.0000.08018.95
5.4.280.0170.06019.14
5.4.270.0100.07719.15
5.4.260.0000.06719.14
5.4.250.0070.07719.23
5.4.240.0100.07318.85
5.4.230.0070.07318.86
5.4.220.0100.06319.06
5.4.210.0170.06018.89
5.4.200.0070.06719.18
5.4.190.0100.07319.15
5.4.180.0100.06019.02
5.4.170.0100.07019.13
5.4.160.0030.08318.89
5.4.150.0100.06719.20
5.4.140.0030.07716.39
5.4.130.0100.07016.52
5.4.120.0070.08016.48
5.4.110.0130.06716.40
5.4.100.0100.06716.42
5.4.90.0100.06716.40
5.4.80.0100.06716.43
5.4.70.0070.07716.38
5.4.60.0030.07316.49
5.4.50.0070.07316.41
5.4.40.0030.07716.39
5.4.30.0000.06016.32
5.4.20.0030.07716.31
5.4.10.0070.07716.33
5.4.00.0070.07315.86
5.3.290.0000.05014.77
5.3.280.0030.07714.70
5.3.270.0070.07714.64
5.3.260.0130.06714.64
5.3.250.0100.07014.71
5.3.240.0100.07014.54
5.3.230.0130.06314.60
5.3.220.0100.07014.56
5.3.210.0100.06714.54
5.3.200.0130.06314.68
5.3.190.0100.07314.67
5.3.180.0070.07314.63
5.3.170.0070.07314.70
5.3.160.0100.07014.51
5.3.150.0070.07014.50
5.3.140.0100.07014.56
5.3.130.0130.04314.57
5.3.120.0070.07714.54
5.3.110.0070.07314.48
5.3.100.0000.07714.07
5.3.90.0070.07313.96
5.3.80.0170.06314.06
5.3.70.0130.06314.05
5.3.60.0070.07714.02
5.3.50.0070.07313.97
5.3.40.0030.07714.00
5.3.30.0130.06713.85
5.3.20.0130.06313.78
5.3.10.0030.07013.66
5.3.00.0070.04313.64
5.2.170.0070.03311.05
5.2.160.0100.04711.19
5.2.150.0030.05011.03
5.2.140.0030.06311.19
5.2.130.0070.05711.03
5.2.120.0030.03711.13
5.2.110.0100.06011.10
5.2.100.0070.06011.01
5.2.90.0030.05711.05
5.2.80.0000.05011.19
5.2.70.0030.04011.08
5.2.60.0070.06311.14
5.2.50.0100.05711.14
5.2.40.0030.06311.03
5.2.30.0000.06711.02
5.2.20.0000.03711.00
5.2.10.0030.03310.73
5.2.00.0030.05310.78
5.1.60.0070.03010.03
5.1.50.0100.0509.99
5.1.40.0030.0539.82
5.1.30.0070.04710.36
5.1.20.0030.06010.36
5.1.10.0100.05010.17
5.1.00.0130.04710.13
5.0.50.0070.0208.89
5.0.40.0070.0378.89
5.0.30.0100.0578.89
5.0.20.0070.0438.89
5.0.10.0070.0208.89
5.0.00.0000.0678.89
4.4.90.0070.0338.89
4.4.80.0100.0278.89
4.4.70.0030.0408.89
4.4.60.0000.0378.89
4.4.50.0000.0378.89
4.4.40.0030.0538.89
4.4.30.0030.0208.89
4.4.20.0100.0308.89
4.4.10.0070.0338.89
4.4.00.0000.0578.89
4.3.110.0000.0278.89
4.3.100.0130.0238.89
4.3.90.0070.0308.89
4.3.80.0070.0478.89
4.3.70.0130.0138.89
4.3.60.0130.0208.89
4.3.50.0000.0378.89
4.3.40.0000.0438.89
4.3.30.0000.0338.89
4.3.20.0030.0338.89
4.3.10.0030.0308.89
4.3.00.0000.0378.89

preferences:
35.79 ms | 401 KiB | 5 Q