3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo ', array_walk: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array/*, array_keys($array)*/); } echo ', array_map: '.(microtime(true) - $t).'\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.100.2860.00314.78
7.2.90.0180.01114.53
7.2.80.1610.01014.69
7.2.70.0220.00714.89
7.2.60.2110.01015.00
7.2.50.0430.00714.80
7.2.40.0390.00914.93
7.2.30.0670.01315.06
7.2.20.1440.00714.74
7.2.10.1390.00714.84
7.2.00.1500.00314.86
7.1.220.1400.01013.58
7.1.210.0480.01113.52
7.1.200.1490.01313.73
7.1.190.0870.00613.76
7.1.180.1910.01013.59
7.1.170.1840.01013.74
7.1.160.0370.00713.82
7.1.150.0640.00613.87
7.1.140.1570.00313.69
7.1.130.0250.01613.84
7.1.120.1510.01313.48
7.1.110.1600.00013.85
7.1.100.0670.00013.89
7.1.90.1380.00713.91
7.1.80.1860.00913.90
7.1.70.1460.00913.83
7.1.60.1410.02231.84
7.1.50.1320.01531.66
7.1.40.1120.00931.43
7.1.30.1120.01432.02
7.1.20.1200.01232.01
7.1.10.1600.01014.11
7.1.00.0640.01313.79
7.0.310.1620.00613.18
7.0.300.0450.01213.31
7.0.290.1550.01613.31
7.0.280.1210.01913.41
7.0.270.1500.00713.44
7.0.260.1410.00713.39
7.0.250.1430.01513.46
7.0.240.0230.01313.20
7.0.230.1540.00713.60
7.0.220.1860.00913.60
7.0.210.1570.01013.29
7.0.200.1390.00313.60
7.0.190.1240.01413.52
7.0.180.0930.00913.64
7.0.170.1090.01213.66
7.0.160.0700.01313.32
7.0.150.0840.00713.67
7.0.140.0960.00413.41
5.6.380.0070.01814.32
5.6.370.0060.02014.37
5.6.360.0070.01814.02
5.6.350.0110.02013.82
5.6.340.0120.01214.05
5.6.330.0170.01314.29
5.6.320.0210.00413.88
5.6.310.0030.01913.98
5.6.300.0150.01514.41
5.6.290.0040.02114.49
5.6.280.0120.01314.71

preferences:
31.66 ms | 400 KiB | 5 Q