3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for($i = 0; $i < pow(10, 5); $i++) { $a[$i] = array( md5(microtime(true)) ); } $sum = 0; $times['for']['before'] = microtime(true); for($j = 0; $i < count($a); $i++) { $sum += 1000; } $times['for']['after'] = microtime(true); unset($sum); $sum = 0; $times['foreach']['before'] = microtime(true); foreach($a as $k) { $sum += 1000; } $times['foreach']['after'] = microtime(true); unset($sum); $t_for = $times['for']['after'] - $times['for']['before']; $t_foreach = $times['foreach']['after'] - $times['foreach']['before']; echo "<pre>"; var_dump(array($times, 'is for faster than foreach?' => $t_for < $t_foreach, $t_for, $t_foreach));

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.00.0230.14560.41
7.3.120.0330.11760.12
7.3.110.0340.13860.01
7.3.100.0260.10960.43
7.3.90.0200.11359.79
7.3.80.0270.13059.88
7.3.70.0260.10260.14
7.3.60.0360.08660.15
7.3.50.0270.09560.20
7.3.40.0200.11660.09
7.3.30.0200.09660.14
7.3.20.0100.09162.96
7.3.10.0300.08862.93
7.3.00.0400.08162.74
7.2.250.0460.12660.33
7.2.240.0270.14760.28
7.2.230.0300.09760.18
7.2.220.0330.12260.48
7.2.210.0290.10859.93
7.2.200.0260.12360.38
7.2.190.0360.08860.02
7.2.180.0330.08660.32
7.2.170.0240.10460.48
7.2.130.0600.10362.93
7.2.120.0820.09662.30
7.2.110.0700.11062.35
7.2.100.1010.09862.87
7.2.90.1320.07762.97
7.2.80.1360.10062.88
7.2.70.1720.09362.83
7.2.60.1660.09162.98
7.2.50.1100.10263.10
7.2.40.0910.10863.14
7.2.30.0920.12363.09
7.2.20.0640.10263.09
7.2.10.1100.09662.92
7.2.00.0560.08964.43
7.1.330.0100.12861.96
7.1.320.0200.13162.15
7.1.310.0100.12961.92
7.1.300.0160.12162.05
7.1.290.0130.11961.89
7.1.280.0100.12362.21
7.1.270.0170.11361.77
7.1.260.0000.13461.87
7.1.250.0700.13261.79
7.1.70.0100.07563.39
7.1.60.0170.14463.58
7.1.50.0200.13563.05
7.1.00.0030.18368.43
7.0.200.6690.12060.73
7.0.140.0200.16368.19
7.0.60.0230.17365.23
7.0.50.0130.12363.12
7.0.40.0100.13323.46
7.0.30.0600.12323.58
7.0.20.0330.13723.57
7.0.10.0030.11723.61
7.0.00.0030.11723.69
5.6.280.0200.25370.25
5.6.210.0230.22369.89
5.6.200.0170.22067.42
5.6.190.0130.18069.55
5.6.180.3970.19069.55
5.6.170.0630.20769.51
5.6.160.0270.23769.54
5.6.150.0070.21067.35
5.6.140.0170.22067.34
5.6.130.0330.23067.33
5.6.120.0270.24070.27
5.6.110.0300.25770.40
5.6.100.0330.22370.25
5.6.90.0270.24370.27
5.6.80.0270.17769.61
5.6.70.4170.17369.79
5.5.350.0470.22069.59
5.5.340.0200.16767.11
5.5.330.0170.20769.39
5.5.320.0530.22769.33
5.5.310.0500.20769.41
5.5.300.0200.20367.15
5.5.290.0300.17367.00
5.5.280.0230.25070.15
5.5.270.0130.24070.15
5.5.260.0230.24369.94
5.5.250.0270.20369.85
5.5.240.0470.22369.54
5.4.450.0670.28368.62
5.4.440.0630.33368.45
5.4.430.0470.30768.78
5.4.420.0400.29768.65
5.4.410.0730.30068.70
5.4.400.0200.28767.83
5.4.390.0300.31367.98
5.4.380.1030.25767.93
5.4.370.0530.30067.70
5.4.360.0670.29067.75
5.4.350.0730.24767.75
5.4.340.0670.28367.96
5.4.320.0320.19261.72
5.4.310.0290.20261.72
5.4.300.0380.19361.73
5.4.290.0370.19361.72
5.4.280.0370.18661.62
5.4.270.0430.31768.36
5.4.260.0430.33367.96
5.4.250.0470.40768.18
5.4.240.0530.40368.11
5.4.230.0470.38768.05
5.4.220.0400.37068.04
5.4.210.0600.29368.13
5.4.200.0670.38367.93
5.4.190.0500.32068.05
5.4.180.0600.34368.12
5.4.170.0300.38367.93
5.4.160.0400.32368.16
5.4.150.0530.36768.04
5.4.140.0570.28765.73
5.4.130.0470.33365.56
5.4.120.0500.48065.58
5.4.110.0630.40065.73
5.4.100.0700.38365.68
5.4.90.0400.35765.55
5.4.80.0430.37765.57
5.4.70.0500.50065.63
5.4.60.0500.33065.78
5.4.50.0400.39365.56
5.4.40.0700.39065.61
5.4.30.0500.37765.71
5.4.20.0600.40365.77
5.4.10.0500.37365.64
5.4.00.0670.36765.01
5.3.290.0340.22961.18
5.3.280.0400.31763.11
5.3.270.0700.40763.08
5.3.260.0500.37763.11
5.3.250.0670.39362.98
5.3.240.0430.38362.74
5.3.230.0570.41062.92
5.3.220.0230.38363.04
5.3.210.0370.34362.99
5.3.200.0330.45763.04
5.3.190.0630.41762.96
5.3.180.0470.32762.90
5.3.170.0400.39362.90
5.3.160.0400.40762.70
5.3.150.0300.44362.92
5.3.140.0600.46363.02
5.3.130.0470.43763.09
5.3.120.0670.45762.91
5.3.110.0700.39763.01
5.3.100.0700.46062.50
5.3.90.0530.38062.46
5.3.80.0800.42762.29
5.3.70.0500.42062.91
5.3.60.0470.47362.33
5.3.50.0370.37062.28
5.3.40.0500.41062.42
5.3.30.0700.43761.98
5.3.20.0400.46062.12
5.3.10.0600.64762.01
5.3.00.0330.60762.07
5.2.170.0730.35357.85
5.2.160.0300.33057.61
5.2.150.0530.41757.54
5.2.140.0600.45357.67
5.2.130.0670.39057.80
5.2.120.0700.33757.56
5.2.110.0700.33757.77
5.2.100.0600.29757.66
5.2.90.0430.51357.70
5.2.80.0330.36357.77
5.2.70.0430.39057.66
5.2.60.0270.41057.75
5.2.50.0600.46357.61
5.2.40.0470.45757.35
5.2.30.0700.40357.42
5.2.20.0630.75057.66
5.2.10.0570.93357.54
5.2.00.0530.67357.40
5.1.60.0600.77771.76
5.1.50.0700.70771.90
5.1.40.0500.87071.89
5.1.30.0370.78772.08
5.1.20.0770.78072.26
5.1.10.0630.94771.83
5.1.00.0670.76071.97
5.0.50.0730.76370.51
5.0.40.0670.95370.01
5.0.30.0670.83770.24
5.0.20.0630.99770.10
5.0.10.0770.89769.98
5.0.00.1170.95069.86
4.4.90.0630.73767.77
4.4.80.0430.86067.75
4.4.70.0600.84767.86
4.4.60.0700.67767.68
4.4.50.0300.69367.79
4.4.40.0330.60767.86
4.4.30.0600.82767.88
4.4.20.0670.70367.86
4.4.10.0470.75767.75
4.4.00.0470.73767.80
4.3.110.0570.75367.70
4.3.100.0600.85767.68
4.3.90.0330.60367.66
4.3.80.0730.90067.65
4.3.70.0570.87767.64
4.3.60.0600.87367.66
4.3.50.0530.86067.84
4.3.40.0370.96367.85
4.3.30.0570.89766.66
4.3.20.0830.90366.61
4.3.10.0600.76766.64
4.3.00.0430.58766.49

preferences:
35.67 ms | 401 KiB | 5 Q