3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(); $l = 10000; for($i = 0; $i< 10000; $i++) { $array[$i] = md5($i); } $copy = $array; $start = microtime(true); for($i = 0; $i< 10000; $i++) { $copy[$i] = $copy[$i] . ' x'; } echo "for:" . microtime(true) - $start; $copy = $array; $start = microtime(true); foreach ($copy as $i => $item) { $copy[$i] = $item . ' x'; } echo "foreach (ohne ref):" . microtime(true) - $start; $copy = $array; $start = microtime(true); foreach ($copy as &$item) { $item .= ' x'; } echo "foreach (ohne ref):" . microtime(true) - $start; $copy = $array; $start = microtime(true); array_walk($copy, function (&$item, $i) { $item .= ' x'; }); echo "array_walk (mit ref):" . microtime(true) - $start; $copy = $array; $start = microtime(true); $copy = array_map(function (&$item, $i) { $x .= ' x'; }, $copy); echo "array_map (mit 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.0040.01821.50
7.1.70.0170.00319.00
7.1.60.0100.02619.32
7.1.50.0100.02118.79
7.1.00.0000.04324.27
7.0.200.0070.00718.46
7.0.140.0100.07324.09
7.0.100.0100.04722.13
7.0.90.0130.04722.03
7.0.80.0130.05322.23
7.0.70.0170.04322.05
7.0.60.0270.08322.02
7.0.50.0100.06322.44
7.0.40.0030.08720.18
7.0.30.0170.07019.95
7.0.20.0100.09020.09
7.0.10.0230.07319.95
7.0.00.0130.09020.10
5.6.280.0070.09725.66
5.6.250.0100.05025.38
5.6.240.0030.05325.26
5.6.230.0100.05025.29
5.6.220.0030.07725.34
5.6.210.0070.10325.40
5.6.200.0030.11325.94
5.6.190.0030.10725.68
5.6.180.0170.09725.90
5.6.170.0170.10325.78
5.6.160.0130.10325.85
5.6.150.0070.09725.86
5.6.140.0130.08725.93
5.6.130.0200.09725.84
5.6.120.0100.10025.83
5.6.110.0130.10325.70
5.6.100.0070.07725.80
5.6.90.0130.10325.91
5.6.80.0130.09725.25
5.6.70.0170.08325.16
5.6.60.0200.09725.19
5.6.50.0130.09025.09
5.6.40.0130.08025.29
5.6.30.0130.10325.14
5.6.20.0070.08725.16
5.6.10.0170.09325.15
5.6.00.0370.07325.05
5.5.380.0100.08025.11
5.5.370.0070.08325.30
5.5.360.0100.08325.32
5.5.350.0030.06325.21
5.5.340.0100.09725.54
5.5.330.0200.09025.56
5.5.320.0100.10325.66
5.5.310.0100.10325.63
5.5.300.0030.10025.58
5.5.290.0100.08025.57
5.5.280.0100.10325.68
5.5.270.0070.06725.51
5.5.260.0230.08725.48
5.5.250.0170.09325.44
5.5.240.0170.08324.86
5.5.230.0170.08025.05
5.5.220.0100.10724.91
5.5.210.0070.09024.93
5.5.200.0070.09724.99
5.5.190.0070.10024.99
5.5.180.0130.09725.02
5.5.160.0070.10324.84
5.5.150.0130.07324.90
5.5.140.0130.10324.98
5.5.130.0130.10024.98
5.5.120.0030.08324.87
5.5.110.0130.05724.74
5.5.100.0100.08724.91
5.5.90.0200.07724.84
5.5.80.0170.09324.77
5.5.70.0100.10024.86
5.5.60.0100.09724.76
5.5.50.0130.09324.76
5.5.40.0030.10324.87
5.5.30.0070.10024.82
5.5.20.0100.10324.71
5.5.10.0130.09724.80
5.5.00.0200.09324.75
5.4.450.0100.09724.06
5.4.440.0170.09324.20
5.4.430.0100.10324.02
5.4.420.0100.10323.90
5.4.410.0200.09323.87
5.4.400.0100.10023.76
5.4.390.0200.08723.71
5.4.380.0130.08323.75
5.4.370.0100.09323.80
5.4.360.0070.09023.70
5.4.350.0070.10723.79
5.4.340.0170.08723.65
5.4.320.0130.09323.75
5.4.310.0170.09723.71
5.4.300.0070.09723.79
5.4.290.0170.07723.81
5.4.280.0100.09323.71
5.4.270.0030.09723.80
5.4.260.0130.08323.88
5.4.250.0030.09723.73
5.4.240.0130.09723.80
5.4.230.0100.09723.75
5.4.220.0100.10323.54
5.4.210.0130.10023.71
5.4.200.0100.09023.69
5.4.190.0130.09023.72
5.4.180.0130.07323.65
5.4.170.0170.09023.71
5.4.160.0230.08723.77
5.4.150.0200.09723.74
5.4.140.0070.09721.25
5.4.130.0100.09021.14
5.4.120.0100.08721.16
5.4.110.0200.07721.15
5.4.100.0070.10721.02
5.4.90.0000.10321.17
5.4.80.0130.07721.23
5.4.70.0130.09021.03
5.4.60.0170.08321.23
5.4.50.0170.08021.04
5.4.40.0100.08021.00
5.4.30.0070.09321.07
5.4.20.0170.08020.98
5.4.10.0070.09721.21
5.4.00.0100.09720.38
5.3.290.0070.10019.08
5.3.280.0170.09319.15
5.3.270.0070.09019.18
5.3.260.0270.07719.09
5.3.250.0130.09019.03
5.3.240.0030.09019.37
5.3.230.0230.08319.15
5.3.220.0000.08719.20
5.3.210.0030.10319.10
5.3.200.0100.10319.12
5.3.190.0100.09319.08
5.3.180.0070.09719.11
5.3.170.0100.09319.12
5.3.160.0100.09318.98
5.3.150.0030.09719.12
5.3.140.0130.08719.12
5.3.130.0170.08319.12
5.3.120.0130.09318.97
5.3.110.0130.08719.07
5.3.100.0100.10018.49
5.3.90.0070.10018.57
5.3.80.0100.09718.53
5.3.70.0170.09718.57
5.3.60.0030.07318.39
5.3.50.0070.10018.50
5.3.40.0070.10018.36
5.3.30.0030.09718.32
5.3.20.0130.08718.13
5.3.10.0070.08318.00
5.3.00.0130.07318.17
5.2.170.0130.05313.64
5.2.160.0000.05013.64
5.2.150.0000.06313.64
5.2.140.0000.06313.64
5.2.130.0130.05013.64
5.2.120.0100.06013.64
5.2.110.0030.05713.64
5.2.100.0070.06313.64
5.2.90.0070.05313.64
5.2.80.0070.05713.64
5.2.70.0100.05713.64
5.2.60.0030.05313.64
5.2.50.0030.06013.64
5.2.40.0030.04013.64
5.2.30.0170.05313.64
5.2.20.0070.05313.64
5.2.10.0000.06713.64
5.2.00.0030.04313.64
5.1.60.0070.05013.64
5.1.50.0000.05713.64
5.1.40.0070.05013.64
5.1.30.0030.04713.64
5.1.20.0030.05713.64
5.1.10.0070.05313.64
5.1.00.0030.05313.64
5.0.50.0030.04713.64
5.0.40.0000.04713.64
5.0.30.0000.06313.64
5.0.20.0070.03713.64
5.0.10.0000.04013.64
5.0.00.0000.06713.64
4.4.90.0000.02713.64
4.4.80.0000.03713.64
4.4.70.0030.03713.64
4.4.60.0000.03713.64
4.4.50.0070.03313.64
4.4.40.0000.04713.64
4.4.30.0030.02013.64
4.4.20.0070.03313.64
4.4.10.0030.03713.64
4.4.00.0070.05013.64
4.3.110.0000.03713.64
4.3.100.0000.03713.64
4.3.90.0070.02713.64
4.3.80.0030.04713.64
4.3.70.0070.03013.64
4.3.60.0070.02713.64
4.3.50.0030.02713.64
4.3.40.0030.05313.64
4.3.30.0000.03713.64
4.3.20.0070.03013.64
4.3.10.0000.03713.64
4.3.00.0000.02713.64

preferences:
38.2 ms | 401 KiB | 5 Q