3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(); $l = 100000; for($i = 0; $i< $l; $i++) { $array[$i] = md5($i); } $copy = $array; $start = microtime(true); for($i = 0; $i< $l; $i++) { $copy[$i] = $copy[$i] . ' x'; } echo "\nfor:" . (microtime(true) - $start); $copy = $array; $start = microtime(true); foreach ($copy as $i => $item) { $copy[$i] = $item . ' x'; } echo "\nforeach (ohne ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); foreach ($copy as &$item) { $item .= ' x'; } echo "\nforeach (mit ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); array_walk($copy, function (&$item, $i) { $item .= ' x'; }); echo "\narray_walk (mit ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); $copy = array_map(function ($item) { $item .= ' x'; return $item; }, $copy); echo "\narray_map (ohne ref):" . (microtime(true) - $start);

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.0030.07841.30
7.1.70.0160.07539.17
7.1.60.0170.11439.44
7.1.50.0070.12739.08
7.1.00.0070.15044.34
7.0.200.0070.08838.76
7.0.140.0100.16744.05
7.0.100.1370.09340.40
7.0.90.1300.11040.43
7.0.80.1370.13040.37
7.0.70.1130.15040.49
7.0.60.1370.14340.50
7.0.50.1130.13040.76
7.0.40.0570.09726.00
7.0.30.0530.10325.97
7.0.20.0770.10025.99
7.0.10.0700.08725.93
7.0.00.0470.09026.02
5.6.280.0370.27369.68
5.6.250.0300.27369.09
5.6.240.0370.23369.16
5.6.230.0300.27369.17
5.6.220.0270.26069.30
5.6.210.0330.29769.30
5.6.200.0770.21369.60
5.6.190.0300.28369.70
5.6.180.0130.23069.67
5.6.170.0330.19769.52
5.6.160.0330.20069.73
5.6.150.0370.22369.67
5.6.140.0370.19369.47
5.6.130.0300.18369.60
5.6.120.0500.16769.55
5.6.110.0370.21069.63
5.6.100.0300.21069.63
5.6.90.0230.26069.59
5.6.80.0500.25069.00
5.6.70.0370.27069.02
5.6.60.0300.27369.10
5.6.50.0270.26768.96
5.6.40.0170.24368.94
5.6.30.0470.25068.88
5.6.20.0370.26768.99
5.6.10.0300.26369.02
5.6.00.0500.20068.88
5.5.380.0200.27768.93
5.5.370.0300.27068.91
5.5.360.0370.27368.89
5.5.350.0200.27368.99
5.5.340.0300.28769.48
5.5.330.0130.27769.48
5.5.320.0330.20069.29
5.5.310.0230.20369.45
5.5.300.0100.20769.37
5.5.290.0230.19369.36
5.5.280.0300.18769.43
5.5.270.0300.21369.35
5.5.260.0300.21369.19
5.5.250.0370.25769.18
5.5.240.0200.29768.69
5.5.230.0400.27368.57
5.5.220.0330.22068.67
5.5.210.0230.33068.70
5.5.200.0270.27768.84
5.5.190.0430.23768.79
5.5.180.0370.26368.68
5.5.160.0430.24768.78
5.5.150.0400.25368.77
5.5.140.0270.28768.80
5.5.130.0300.29768.66
5.5.120.0300.29068.73
5.5.110.0530.22068.73
5.5.100.0230.22768.69
5.5.90.0430.25068.70
5.5.80.0430.27768.56
5.5.70.0470.28768.59
5.5.60.0370.31368.67
5.5.50.0400.26768.62
5.5.40.0130.28068.46
5.5.30.1500.25068.58
5.5.20.0430.27768.61
5.5.10.0300.26068.53
5.5.00.0330.26368.59
5.4.450.0170.24768.00
5.4.440.0330.21767.66
5.4.430.0270.22067.87
5.4.420.0230.18768.03
5.4.410.0470.25767.90
5.4.400.0330.28067.68
5.4.390.0430.25067.51
5.4.380.0430.24067.38
5.4.370.1300.26067.52
5.4.360.0470.23067.52
5.4.350.0430.28767.48
5.4.340.0330.26767.46
5.4.320.0270.28367.67
5.4.310.0370.25367.57
5.4.300.0300.26367.55
5.4.290.0430.27767.32
5.4.280.0400.24767.52
5.4.270.0270.21767.54
5.4.260.0300.26367.48
5.4.250.0300.24767.50
5.4.240.0400.27367.52
5.4.230.0300.24367.53
5.4.220.0300.27767.58
5.4.210.0400.28767.31
5.4.200.0270.28067.55
5.4.190.0470.33767.50
5.4.180.0270.27367.69
5.4.170.0270.28067.69
5.4.160.0770.19067.57
5.4.150.0370.31767.36
5.4.140.0270.23764.91
5.4.130.0330.29064.93
5.4.120.0500.20364.82
5.4.110.0130.27764.96
5.4.100.0100.25764.88
5.4.90.0330.26364.98
5.4.80.0230.25764.91
5.4.70.0400.23764.82
5.4.60.0270.27364.91
5.4.50.0570.25764.93
5.4.40.0370.24764.79
5.4.30.0170.31365.01
5.4.20.0330.23765.00
5.4.10.0430.23764.79
5.4.00.0430.22364.12
5.3.290.0200.28363.04
5.3.280.0270.29062.97
5.3.270.0400.27062.92
5.3.260.0370.28062.94
5.3.250.0330.30362.95
5.3.240.0230.27763.02
5.3.230.0400.28762.83
5.3.220.0270.27762.98
5.3.210.0200.28362.85
5.3.200.0330.26062.84
5.3.190.0230.27362.80
5.3.180.0230.28362.83
5.3.170.0200.27062.90
5.3.160.0300.28362.79
5.3.150.0270.28062.88
5.3.140.0230.25362.86
5.3.130.0170.28362.83
5.3.120.0200.19062.78
5.3.110.0400.33062.91
5.3.100.0170.21362.27
5.3.90.0270.21362.34
5.3.80.0270.23762.33
5.3.70.0130.23762.23
5.3.60.0330.21362.48
5.3.50.0270.27362.15
5.3.40.0200.28062.13
5.3.30.0100.27062.14
5.3.20.0830.25062.01
5.3.10.0170.26361.85
5.3.00.0230.23361.80
5.2.170.0000.04311.83
5.2.160.0000.03711.83
5.2.150.0070.05711.83
5.2.140.0070.03711.83
5.2.130.0000.06011.83
5.2.120.0030.06011.83
5.2.110.0070.06311.83
5.2.100.0030.03011.83
5.2.90.0070.05011.83
5.2.80.0070.03011.83
5.2.70.0000.04011.83
5.2.60.0100.03311.83
5.2.50.0130.04011.83
5.2.40.0030.02711.83
5.2.30.0100.05711.83
5.2.20.0030.02311.83
5.2.10.0100.04311.83
5.2.00.0070.05711.83
5.1.60.0000.03711.83
5.1.50.0000.02711.83
5.1.40.0000.05011.83
5.1.30.0000.02711.83
5.1.20.0000.03011.83
5.1.10.0030.05011.83
5.1.00.0000.04311.83
5.0.50.0000.02011.83
5.0.40.0070.01311.83
5.0.30.0000.06011.83
5.0.20.0000.04311.83
5.0.10.0030.04011.83
5.0.00.0070.05011.83
4.4.90.0000.03311.83
4.4.80.0000.03311.83
4.4.70.0000.04011.83
4.4.60.0030.03711.83
4.4.50.0000.01311.83
4.4.40.0000.02311.83
4.4.30.0030.03711.83
4.4.20.0030.01311.83
4.4.10.0000.01711.83
4.4.00.0030.03011.83
4.3.110.0030.03011.83
4.3.100.0070.02711.83
4.3.90.0070.02711.83
4.3.80.0030.04011.83
4.3.70.0030.02011.83
4.3.60.0000.03011.83
4.3.50.0000.02011.83
4.3.40.0000.05311.83
4.3.30.0070.03311.83
4.3.20.0000.01711.83
4.3.10.0030.02711.83
4.3.00.0000.02311.83

preferences:
41.48 ms | 400 KiB | 5 Q