3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100000; $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.0102.49120.83
7.1.60.0032.49821.48
7.1.50.0172.48521.11
7.1.00.0032.49726.19
7.0.200.0432.45720.94
7.0.140.0032.49726.12
7.0.70.2732.22722.96
7.0.60.0132.48722.86
7.0.50.0132.48720.95
7.0.40.0102.49022.90
7.0.30.0532.44722.86
7.0.20.0302.47022.99
7.0.10.0402.46023.03
7.0.00.0102.49022.86
5.6.280.0002.50035.07
5.6.210.0102.49034.86
5.6.200.0232.47732.27
5.6.190.0172.45334.54
5.6.180.0102.49034.67
5.6.170.0432.45734.52
5.6.160.0202.48034.57
5.6.150.0202.48032.34
5.6.140.0132.48732.40
5.6.130.0172.48332.32
5.6.120.0172.48335.17
5.6.110.0132.48735.31
5.6.100.0102.49035.14
5.6.90.0072.49335.15
5.6.80.0102.49034.66
5.6.70.0172.46734.56
5.5.350.0302.38034.68
5.5.340.0202.33735.03
5.5.330.0072.40335.12
5.5.320.0172.43335.12
5.5.310.0202.46035.06
5.5.300.0372.40335.15
5.5.290.0332.42735.06
5.5.280.0132.42734.90
5.5.270.0272.41035.11
5.5.260.0302.44034.89
5.5.250.0132.42734.93
5.5.240.0332.37734.35
5.4.450.0172.44333.55
5.4.440.0202.45733.58
5.4.430.0372.43733.52
5.4.420.0132.43333.51
5.4.410.0232.43033.45
5.4.400.0502.41333.13
5.4.390.0502.39033.07
5.4.380.0232.42733.25
5.4.370.0102.46333.22
5.4.360.0232.39333.10
5.4.350.0472.38733.25
5.4.340.0402.39733.21
5.4.320.0332.41033.04
5.4.310.0132.45733.29
5.4.300.0472.39033.40
5.4.290.0532.28333.17
5.4.280.0302.43333.07
5.4.270.0172.41333.25
5.4.260.0232.45033.23
5.4.250.0332.43333.21
5.4.240.0232.41733.07
5.4.230.0451.49028.79
5.4.220.0321.48628.82
5.4.210.0521.52828.83
5.4.200.0351.50328.72
5.4.190.0401.42028.82
5.4.180.0511.27628.70
5.4.170.0491.27928.77
5.4.160.0501.50528.70
5.4.150.0501.47228.70
5.4.140.0421.46827.71
5.4.130.0481.45527.72
5.4.120.0551.40227.66
5.4.110.0481.44327.62
5.4.100.0421.35627.66
5.4.90.0481.29227.67
5.4.80.0421.25127.67
5.4.70.0431.50527.61
5.4.60.0401.38727.57
5.4.50.0371.36927.66
5.4.40.0361.30627.62
5.4.30.0411.46227.64
5.4.20.0481.42927.60
5.4.10.0381.40227.57
5.4.00.0411.31827.05
5.3.290.0202.42028.46
5.3.280.0441.37127.21
5.3.270.0401.20127.22
5.3.260.0491.18327.21
5.3.250.0401.33927.22
5.3.240.0521.29327.21
5.3.230.0401.28627.20
5.3.220.0341.25127.18
5.3.210.0371.33727.23
5.3.200.0391.27027.12
5.3.190.0521.10327.18
5.3.180.0401.16027.13
5.3.170.0311.17727.15
5.3.160.0471.21327.18
5.3.150.0391.21727.15
5.3.140.0471.19927.14
5.3.130.0441.24627.15
5.3.120.0501.14127.13
5.3.110.0421.28127.16
5.3.100.0361.12426.64
5.3.90.0421.04126.61
5.3.80.0331.09126.60
5.3.70.0291.15326.61
5.3.60.0491.18626.57
5.3.50.0421.29926.52

preferences:
36.53 ms | 401 KiB | 5 Q