3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 10000; $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).'\n'; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo 'array_walk: '.(microtime(true) - $t).'\n'; $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.1.70.0002.50117.22
7.1.60.0032.49819.17
7.1.50.0002.50117.22
7.1.00.0072.49322.21
7.0.200.0002.50116.84
7.0.140.0072.49321.95
7.0.70.4902.01020.23
7.0.60.0102.49020.25
7.0.50.0132.48718.07
7.0.40.0072.49319.96
7.0.30.0502.45019.98
7.0.20.0402.46019.94
7.0.10.0332.46719.81
7.0.00.0072.49319.88
5.6.280.0132.48722.30
5.6.210.0072.49321.91
5.6.200.0172.48319.60
5.6.190.0102.49021.83
5.6.180.0102.49021.81
5.6.170.0272.47321.84
5.6.160.0072.49321.75
5.6.150.0072.49319.67
5.6.140.0002.50019.60
5.6.130.0002.50019.58
5.6.120.0102.49022.34
5.6.110.0072.49322.47
5.6.100.0072.49322.42
5.6.90.0072.49322.56
5.6.80.0072.49321.83
5.6.70.0072.49321.86
5.5.350.0271.82322.05
5.5.340.0202.06022.43
5.5.330.0331.81022.31
5.5.320.0271.97322.24
5.5.310.0131.97322.40
5.5.300.0171.94722.39
5.5.290.0172.38722.32
5.5.280.0272.41722.41
5.5.270.0302.42022.30
5.5.260.0302.37322.36
5.5.250.0072.45322.05
5.5.240.0272.40021.76
5.4.450.0402.17020.61
5.4.440.0202.38320.82
5.4.430.0272.39020.88
5.4.420.0172.45320.98
5.4.410.0132.42020.74
5.4.400.0232.43320.55
5.4.390.0202.40020.64
5.4.380.0372.36720.33
5.4.370.0302.37320.51
5.4.360.0202.43320.49
5.4.350.0372.38320.30
5.4.340.0332.41320.51
5.4.320.0172.40720.54
5.4.310.0132.43720.40
5.4.300.0102.43020.66
5.4.290.0202.42320.40
5.4.280.0132.41020.55
5.4.270.0172.42020.51
5.4.260.0132.42320.51
5.4.250.0202.41720.62
5.4.240.0132.42720.66
5.4.230.0251.74017.14
5.4.220.0331.72217.05
5.4.210.0311.69717.16
5.4.200.0311.78517.15
5.4.190.0281.65017.21
5.4.180.0191.64017.14
5.4.170.0331.62517.15
5.4.160.0301.55617.07
5.4.150.0271.65417.06
5.4.140.0221.67215.69
5.4.130.0261.61215.57
5.4.120.0261.61815.67
5.4.110.0311.56315.55
5.4.100.0421.60715.69
5.4.90.0421.58015.68
5.4.80.0211.62415.67
5.4.70.0201.61515.66
5.4.60.0291.59815.71
5.4.50.0241.68215.55
5.4.40.0251.64215.59
5.4.30.0221.62015.58
5.4.20.0261.55215.65
5.4.10.0161.51715.67
5.4.00.0321.55015.14
5.3.290.0172.41715.92
5.3.280.0191.54214.96
5.3.270.0281.52614.96
5.3.260.0271.55214.96
5.3.250.0211.45814.90
5.3.240.0291.51714.94
5.3.230.0171.53614.93
5.3.220.0241.48114.87
5.3.210.0251.51014.93
5.3.200.0311.53814.92
5.3.190.0441.50714.92
5.3.180.0271.50814.93
5.3.170.0251.53814.91
5.3.160.0221.55714.98
5.3.150.0231.65414.91
5.3.140.0181.65914.89
5.3.130.0251.52214.91
5.3.120.0411.64614.87
5.3.110.0221.83714.97
5.3.100.0321.74914.39
5.3.90.0241.79814.38
5.3.80.0251.67814.34
5.3.70.0381.88314.34
5.3.60.0242.00814.24
5.3.50.0241.88114.27

preferences:
47.12 ms | 401 KiB | 5 Q