3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for($i = 0; $i < pow(10, 5); $i++) { $a[$i] = array( md5($i.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']; var_dump(array( 'for' => sprintf('%f', $t_for), 'foreach' => sprintf('%f', $t_foreach), 'is \'for\' faster than \'foreach\'?' => $t_for < $t_foreach, 'how much faster?' => (1 - ($t_for / $t_foreach)) * 100).'%' );

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.0560.08265.48
7.1.70.0850.11463.27
7.1.60.0260.13263.32
7.1.50.0240.13963.32
7.1.00.0200.16768.71
7.0.200.6550.10360.70
7.0.140.0070.18068.23
7.0.60.0200.18765.23
7.0.50.0330.17063.13
7.0.40.0230.15723.71
7.0.30.0270.12723.63
7.0.20.0400.15723.75
7.0.10.0500.12323.61
7.0.00.0100.18323.57
5.6.280.0170.26770.31
5.6.210.0300.22770.02
5.6.200.0230.25067.34
5.6.190.0300.23369.72
5.6.180.3400.17769.59
5.6.170.0300.20069.58
5.6.160.0200.21769.65
5.6.150.0170.20067.43
5.6.140.0200.23067.34
5.6.130.0300.18767.29
5.6.120.0300.20070.38
5.6.110.0070.19070.24
5.6.100.0300.23770.14
5.6.90.0270.22070.36
5.6.80.0270.22069.64
5.6.70.0270.15769.62
5.5.350.0230.23069.61
5.5.340.0370.22367.23
5.5.330.0300.25369.39
5.5.320.0370.20069.30
5.5.310.0470.24069.42
5.5.300.0200.24067.18
5.5.290.0200.25067.15
5.5.280.0270.17069.95
5.5.270.0070.26069.91
5.5.260.0130.27070.14
5.5.250.0300.22069.88
5.5.240.0400.25069.62
5.4.450.0870.35068.65
5.4.440.0570.39368.83
5.4.430.0870.37368.46
5.4.420.1170.30068.82
5.4.410.0670.34768.53
5.4.400.0630.29368.02
5.4.390.0300.32067.98
5.4.380.0730.31367.95
5.4.370.0600.33767.91
5.4.360.0730.31067.89
5.4.350.0730.30767.89
5.4.340.0630.31767.84
5.4.320.0270.21461.73
5.4.310.0350.21961.72
5.4.300.0360.22361.72
5.4.290.0480.21561.72
5.4.280.0400.21361.62
5.4.270.0700.43068.13
5.4.260.0300.43768.20
5.4.250.0570.49067.93
5.4.240.0330.46767.97
5.4.230.0470.51368.16
5.4.220.0500.36768.13
5.4.210.0600.51768.28
5.4.200.0370.37368.19
5.4.190.0370.30767.96
5.4.180.0370.53368.12
5.4.170.0500.33368.11
5.4.160.0370.31768.07
5.4.150.0600.38068.19
5.4.140.0830.44065.80
5.4.130.0430.41765.51
5.4.120.0570.38065.64
5.4.110.0730.42365.60
5.4.100.0570.34365.78
5.4.90.0430.33065.75
5.4.80.0400.34065.59
5.4.70.0430.34365.68
5.4.60.0500.38065.69
5.4.50.0330.43365.69
5.4.40.0670.44765.63
5.4.30.0470.32065.56
5.4.20.0770.40365.65
5.4.10.0400.34365.59
5.4.00.0330.32764.99
5.3.290.0290.24661.18
5.3.280.0330.40763.00
5.3.270.0630.44062.93
5.3.260.0500.41062.98
5.3.250.0600.46762.92
5.3.240.0530.42362.97
5.3.230.0270.39362.94
5.3.220.0500.52762.95
5.3.210.0430.45062.93
5.3.200.0530.42762.70
5.3.190.0370.44363.04
5.3.180.0770.52062.70
5.3.170.0670.50362.99
5.3.160.0700.39362.88
5.3.150.0270.39362.86
5.3.140.0400.46362.69
5.3.130.0400.36063.08
5.3.120.0530.32063.02
5.3.110.0430.32062.98
5.3.100.0570.35362.41
5.3.90.0430.46762.49
5.3.80.0470.30762.09
5.3.70.0430.36762.29
5.3.60.0500.45762.29
5.3.50.0700.39062.20
5.3.40.0570.36762.34
5.3.30.0430.39362.07
5.3.20.0330.49361.76
5.3.10.0300.52361.92
5.3.00.0370.47762.05
5.2.170.0330.38357.85
5.2.160.0370.49757.71
5.2.150.0200.46057.74
5.2.140.0400.38757.55
5.2.130.0470.41357.73
5.2.120.0330.37357.37
5.2.110.0500.34757.57
5.2.100.0370.32357.50
5.2.90.0430.38057.57
5.2.80.0270.35357.54
5.2.70.0170.36757.78
5.2.60.0470.45057.32
5.2.50.0400.43357.54
5.2.40.0400.35057.48
5.2.30.0530.37057.13
5.2.20.0270.62357.54
5.2.10.0370.60757.55
5.2.00.0630.54057.33
5.1.60.0430.65771.79
5.1.50.0430.63771.85
5.1.40.0470.81771.94
5.1.30.0700.78372.07
5.1.20.0400.75371.91
5.1.10.0570.81371.76
5.1.00.0730.87771.92
5.0.50.0400.82070.54
5.0.40.0601.02770.27
5.0.30.1071.05770.11
5.0.20.0731.07070.10
5.0.10.0630.95770.07
5.0.00.0771.02770.15
4.4.90.0500.75367.70
4.4.80.0630.93767.68
4.4.70.0470.78067.68
4.4.60.0470.67067.80
4.4.50.0530.60767.86
4.4.40.0770.83767.68
4.4.30.0400.68067.76
4.4.20.0570.76767.90
4.4.10.0600.67367.91
4.4.00.0670.92367.83
4.3.110.0370.76767.77
4.3.100.0570.75067.77
4.3.90.0430.86767.62
4.3.80.0570.79367.60
4.3.70.0670.77067.66
4.3.60.0430.92767.69
4.3.50.0730.86367.93
4.3.40.0670.80767.88
4.3.30.0500.87766.73
4.3.20.0470.82066.63
4.3.10.0400.66366.55
4.3.00.0700.66066.46

preferences:
37.98 ms | 401 KiB | 5 Q