3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial Configuration global $aHash; $i = 0; $tmp = ''; while($i < 10000) { $tmp .= 'a'; ++$i; } $aHash = array_fill(100000000000000000000000, 100, $tmp); unset($i, $tmp); // Test Source function Test2_1() { global $aHash; /* The Test */ $t = microtime(true); reset($aHash); foreach($aHash as $key=>$val) $aHash[$key] .= "a"; return (microtime(true) - $t); } // Test Source function Test2_3() { global $aHash; /* The Test */ $t = microtime(true); $key = array_keys($aHash); $size = sizeOf($key); for ($i=0; $i<$size; $i++) $aHash[$key[$i]] .= "a"; return (microtime(true) - $t); } // Variable Clean-up function Test2_End() { global $aHash; unset($aHash); } var_dump(Test2_1()); var_dump(Test2_3()); ?>

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.0070.00719.24
7.1.70.0000.00817.22
7.1.60.0070.02019.32
7.1.50.0130.01317.01
7.1.00.0070.07322.43
7.0.200.0030.00616.78
7.0.140.0070.07022.07
7.0.60.0070.06019.94
7.0.50.0030.06317.86
7.0.40.0030.04320.24
7.0.30.0600.06020.26
7.0.20.0270.07020.21
7.0.10.0100.04020.19
7.0.00.0170.07020.29
5.6.280.0070.07322.02
5.6.210.0070.08021.39
5.6.200.0070.08019.08
5.6.190.0070.05721.16
5.6.180.0370.08021.05
5.6.170.0300.07721.34
5.6.160.0070.05721.43
5.6.150.0070.04019.07
5.6.140.0100.07319.14
5.6.130.0100.03718.96
5.6.120.0030.07021.72
5.6.110.0070.05021.97
5.6.100.0230.07022.12
5.6.90.0030.04722.01
5.6.80.0170.05321.31
5.5.350.0200.07321.27
5.5.340.0000.04718.78
5.5.330.0030.04021.04
5.5.320.0370.04321.07
5.5.310.0270.06321.03
5.5.300.0100.07718.89
5.5.290.0100.06718.89
5.5.280.0100.06721.79
5.5.270.0100.08021.67
5.5.260.0000.06321.71
5.5.250.0170.08021.63
5.5.240.0300.06721.09
5.4.450.0200.06720.26
5.4.440.0830.05720.16
5.4.430.0800.05720.37
5.4.420.0630.00020.10
5.4.410.0670.00019.99
5.4.400.0630.00019.80
5.4.390.0630.00019.76
5.4.380.0630.00019.82
5.4.370.0670.00019.90
5.4.360.0630.00019.79
5.4.350.0670.00019.77
5.4.340.0080.03412.81
5.4.320.0070.03713.30
5.4.310.0070.04213.29
5.4.300.0110.03613.30
5.4.290.0080.04013.30
5.4.280.0040.04013.20
5.4.270.0070.03613.19
5.4.260.0050.04013.19
5.4.250.0040.04013.19
5.4.240.0070.03713.20
5.4.230.0100.03713.19
5.4.220.0050.04513.18
5.4.210.0090.03413.19
5.4.200.0080.03713.18
5.4.190.0050.04213.18
5.4.180.0050.03713.18
5.4.170.0100.03413.20
5.4.160.0060.03913.18
5.4.150.0090.03713.18
5.4.140.0060.03712.86
5.4.130.0090.03512.85
5.4.120.0040.03812.81
5.4.110.0070.03912.80
5.4.100.0100.03512.80
5.4.90.0060.03812.80
5.4.80.0090.03912.80
5.4.70.0090.03212.80
5.4.60.0050.03712.80
5.4.50.0060.03512.80
5.4.40.0100.03312.79
5.4.30.0070.03512.79
5.4.20.0080.04012.79
5.4.10.0110.03312.79
5.4.00.0110.03612.28
5.3.290.0090.04513.70
5.3.280.0080.04013.62
5.3.270.0080.03813.64
5.3.260.0060.03913.64
5.3.250.0060.04413.63
5.3.240.0080.03613.63
5.3.230.0040.04313.62
5.3.220.0080.04413.59
5.3.210.0090.03813.59
5.3.200.0090.04213.59
5.3.190.0080.03613.59
5.3.180.0050.03813.59
5.3.170.0090.03513.59
5.3.160.0110.03713.59
5.3.150.0050.04013.59
5.3.140.0070.03613.59
5.3.130.0040.04113.57
5.3.120.0060.04213.57
5.3.110.0040.04513.57
5.3.100.0070.03613.07
5.3.90.0050.03813.05
5.3.80.0100.03613.04
5.3.70.0060.03613.04
5.3.60.0090.03513.02
5.3.50.0060.04212.97
5.3.40.0050.03912.97
5.3.30.0060.03512.94
5.3.20.0080.03412.71
5.3.10.0040.03712.68
5.3.00.0060.03712.66
5.2.170.0060.03010.17
5.2.160.0040.03410.16
5.2.150.0080.02810.17
5.2.140.0060.03010.16
5.2.130.0020.03310.12
5.2.120.0040.03110.13
5.2.110.0080.02710.13
5.2.100.0060.02910.12
5.2.90.0040.03110.12
5.2.80.0060.03010.11
5.2.70.0070.02910.18
5.2.60.0010.03510.07
5.2.50.0060.03010.04
5.2.40.0060.02910.01
5.2.30.0050.0319.78
5.2.20.0050.0299.77
5.2.10.0080.0269.68
5.2.00.0060.0289.55
5.1.60.0060.0239.09
5.1.50.0050.0259.09
5.1.40.0050.0339.07
5.1.30.0060.0269.42
5.1.20.0050.0329.45
5.1.10.0030.0299.17
5.1.00.0040.0289.17
5.0.50.0040.0267.64
5.0.40.0050.0247.51
5.0.30.0050.0327.32
5.0.20.0040.0307.32
5.0.10.0020.0237.29
5.0.00.0040.0377.28
4.4.90.0060.0215.66
4.4.80.0070.0165.64
4.4.70.0030.0195.64
4.4.60.0020.0205.64
4.4.50.0030.0175.65
4.4.40.0010.0295.65
4.4.30.0010.0205.64
4.4.20.0050.0165.70
4.4.10.0070.0155.71
4.4.00.0030.0275.68
4.3.110.0050.0165.58
4.3.100.0050.0165.57
4.3.90.0030.0235.59
4.3.80.0030.0295.59
4.3.70.0030.0175.59
4.3.60.0040.0185.59
4.3.50.0050.0165.58
4.3.40.0030.0275.54
4.3.30.0040.0174.35
4.3.20.0030.0194.33
4.3.10.0020.0204.29
4.3.00.0130.0307.03

preferences:
41.42 ms | 404 KiB | 6 Q