3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Foreach - inline $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.1.0
Warning: array_fill() expects parameter 1 to be integer, float given in /in/2MGND on line 13 Warning: Invalid argument supplied for foreach() in /in/2MGND on line 18 5.0067901611328
Output for 7.0.14
Warning: array_fill() expects parameter 1 to be integer, float given in /in/2MGND on line 13 Warning: Invalid argument supplied for foreach() in /in/2MGND on line 18 3.814697265625
Output for 7.0.1 - 7.0.2, 7.0.6
Warning: array_fill() expects parameter 1 to be integer, float given in /in/2MGND on line 13 Warning: Invalid argument supplied for foreach() in /in/2MGND on line 18 3.0994415283203
Output for 7.0.0, 7.0.5
Warning: array_fill() expects parameter 1 to be integer, float given in /in/2MGND on line 13 Warning: Invalid argument supplied for foreach() in /in/2MGND on line 18 4.0531158447266
Output for 7.0.3 - 7.0.4
Warning: array_fill() expects parameter 1 to be integer, float given in /in/2MGND on line 13 Warning: Invalid argument supplied for foreach() in /in/2MGND on line 18 2.8610229492188
Output for hhvm-3.12.0
324.01084899902
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
411.03363037109
Output for 5.6.21
332.11708068848
Output for 5.6.20
494.95697021484
Output for 5.6.19
336.1701965332
Output for 5.6.18
442.9817199707
Output for 5.6.17
473.0224609375
Output for 5.6.16
504.97055053711
Output for 5.6.15
488.9965057373
Output for 5.6.14
349.04479980469
Output for 5.6.13
441.07437133789
Output for 5.6.12
351.90582275391
Output for 5.4.0, 5.5.31, 5.6.11
432.01446533203
Output for 5.6.10
545.02487182617
Output for 5.6.9
488.0428314209
Output for 5.6.8
528.09715270996
Output for 5.5.35
447.03483581543
Output for 5.5.27, 5.5.34
442.0280456543
Output for 5.5.33
510.93101501465
Output for 5.5.32
393.86749267578
Output for 5.5.30
443.93539428711
Output for 5.5.29
538.11073303223
Output for 5.5.28
501.15585327148
Output for 5.5.26
468.96934509277
Output for 5.5.25
346.89903259277
Output for 5.5.24
527.14347839355
Output for 5.4.45
652.07481384277
Output for 5.4.44
622.98774719238
Output for 5.4.43
698.08959960938
Output for 5.4.42
599.14588928223
Output for 5.4.41
1508.9511871338
Output for 5.4.40
1087.9039764404
Output for 5.4.39
1027.1072387695
Output for 5.4.38
1044.0349578857
Output for 5.4.37
596.04644775391
Output for 5.4.36
664.94941711426
Output for 5.4.35
674.00932312012
Output for 5.4.34
617.02728271484
Output for 5.4.32
270.84350585938
Output for 5.4.31
308.03680419922
Output for 5.4.30
294.92378234863
Output for 5.4.29
273.9429473877
Output for 5.4.28
415.08674621582
Output for 5.4.27
468.01567077637
Output for 5.4.26
497.10273742676
Output for 5.4.25
509.02366638184
Output for 5.4.24
471.11511230469
Output for 5.4.23
545.97854614258
Output for 5.4.22
508.06999206543
Output for 5.4.21
483.03604125977
Output for 5.4.20
469.92301940918
Output for 5.4.19
416.99409484863
Output for 5.4.18
724.07722473145
Output for 5.4.17
548.12431335449
Output for 5.4.16
496.86431884766
Output for 5.4.15
474.92980957031
Output for 5.4.14
452.04162597656
Output for 5.4.13
509.97734069824
Output for 5.4.12
9552.9556274414
Output for 5.4.11
477.07557678223
Output for 5.4.10
458.0020904541
Output for 5.4.9
479.93659973145
Output for 5.4.8
593.90068054199
Output for 5.4.7
569.82040405273
Output for 5.4.6
506.87789916992
Output for 5.4.5
513.07678222656
Output for 5.4.4
1013.9942169189
Output for 5.4.3
896.93069458008
Output for 5.4.2
335.9317779541
Output for 5.4.1
10535.001754761
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/2MGND 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/2MGND on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2MGND on line 3
Process exited with code 255.