3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Foreach with brackets $results = []; $aHash = []; $i = 0; $tmp = ''; while ($i < 10000) { $tmp .= 'a'; ++$i; } $aHash = array_fill(100000000000000000000000, 100, $tmp); unset($i, $tmp); /* The Test */ $t = microtime(true); foreach ($aHash as $key => $val) { $aHash[$key] .= "a"; } echo (microtime(true) - $t) * 1000000;
Output for 7.0.3, 7.1.0
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 4.0531158447266
Output for 7.0.14
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 5.9604644775391
Output for 7.0.5 - 7.0.6
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 3.0994415283203
Output for 7.0.2, 7.0.4
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 2.8610229492188
Output for 7.0.1
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 2.1457672119141
Output for 7.0.0
Warning: array_fill() expects parameter 1 to be integer, float given in /in/m60pT on line 13 Warning: Invalid argument supplied for foreach() in /in/m60pT on line 18 3.814697265625
Output for 5.6.28
411.9873046875
Output for 5.6.21
513.07678222656
Output for 5.6.20
479.93659973145
Output for 5.6.19
362.15782165527
Output for 5.6.18
324.96452331543
Output for 5.6.17
464.91622924805
Output for 5.6.16
358.10470581055
Output for 5.6.15
518.0835723877
Output for 5.6.8, 5.6.14
540.01808166504
Output for 5.6.13
523.80561828613
Output for 5.6.12
492.09594726562
Output for 5.6.11
490.90385437012
Output for 5.6.10
385.04600524902
Output for 5.4.1, 5.6.9
486.13548278809
Output for 5.6.7
247.00164794922
Output for 5.5.35
463.00888061523
Output for 5.5.34
344.99168395996
Output for 5.5.33
441.07437133789
Output for 5.5.27, 5.5.32
376.93977355957
Output for 5.5.31
433.92181396484
Output for 5.5.30
497.10273742676
Output for 5.5.29
460.14785766602
Output for 5.5.28
368.11828613281
Output for 5.5.26
534.0576171875
Output for 5.5.25
359.05838012695
Output for 5.5.24
538.11073303223
Output for 5.4.45
819.92149353027
Output for 5.4.44
635.14709472656
Output for 5.4.43
583.17184448242
Output for 5.4.42
897.16911315918
Output for 5.4.41
671.1483001709
Output for 5.4.40
878.81088256836
Output for 5.4.39
751.97219848633
Output for 5.4.38
649.92904663086
Output for 5.4.37
315.90461730957
Output for 5.4.36
591.03965759277
Output for 5.4.20, 5.4.35
581.02607727051
Output for 5.4.34
314.95094299316
Output for 5.4.32
277.99606323242
Output for 5.4.31
296.11587524414
Output for 5.4.30
272.03559875488
Output for 5.4.29
298.97689819336
Output for 5.4.28
365.9725189209
Output for 5.4.27
363.82675170898
Output for 5.4.26
448.94218444824
Output for 5.4.25
583.88710021973
Output for 5.4.24
450.13427734375
Output for 5.4.23
531.19659423828
Output for 5.4.22
608.20579528809
Output for 5.4.21
638.96179199219
Output for 5.4.19
513.79203796387
Output for 5.4.18
435.82916259766
Output for 5.4.17
492.81120300293
Output for 5.4.16
498.05641174316
Output for 5.4.15
425.10032653809
Output for 5.4.14
447.03483581543
Output for 5.4.13
601.05323791504
Output for 5.4.12
548.12431335449
Output for 5.4.11
557.89947509766
Output for 5.4.10
491.85752868652
Output for 5.4.9
505.92422485352
Output for 5.4.8
563.8599395752
Output for 5.4.7
633.95500183105
Output for 5.4.6
484.94338989258
Output for 5.4.5
2032.0415496826
Output for 5.4.4
632.04765319824
Output for 5.4.3
339.03121948242
Output for 5.4.2
542.87910461426
Output for 5.4.0
463.96255493164
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/m60pT on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/m60pT on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/m60pT on line 3
Process exited with code 255.