3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array_fill(0, 500000, ['test' => 'hello']); $start = microtime(true); foreach ($arr as $ar) {} echo 'Array Iteration :' . round(microtime(true) - $start, 4) . "\n"; $arr = SplFixedArray::fromArray($arr); $start = microtime(true); foreach ($arr as $ar) {} echo 'SPL Iteration :' . round(microtime(true) - $start, 4) . "\n";
Output for 7.1.0
Array Iteration :0.0109 SPL Iteration :0.0142
Output for 7.0.14
Array Iteration :0.0073 SPL Iteration :0.0141
Output for 7.0.6
Array Iteration :0.0068 SPL Iteration :0.0125
Output for 7.0.5
Array Iteration :0.0056 SPL Iteration :0.0112
Output for 7.0.4
Array Iteration :0.0068 SPL Iteration :0.0122
Output for 7.0.3
Array Iteration :0.0048 SPL Iteration :0.0092
Output for 7.0.2
Array Iteration :0.0049 SPL Iteration :0.0093
Output for 7.0.1
Array Iteration :0.0063 SPL Iteration :0.0092
Output for 7.0.0
Array Iteration :0.0062 SPL Iteration :0.0118
Output for hhvm-3.12.0
Array Iteration :0.012 SPL Iteration :0.5184
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
Array Iteration :0.0195 SPL Iteration :0.0366
Output for 5.6.21
Array Iteration :0.0147 SPL Iteration :0.0306
Output for 5.6.20
Array Iteration :0.0121 SPL Iteration :0.0292
Output for 5.6.19
Array Iteration :0.0178 SPL Iteration :0.0358
Output for 5.6.18
Array Iteration :0.0172 SPL Iteration :0.034
Output for 5.6.17
Array Iteration :0.0124 SPL Iteration :0.0309
Output for 5.6.16
Array Iteration :0.0153 SPL Iteration :0.0361
Output for 5.6.15
Array Iteration :0.0158 SPL Iteration :0.0323
Output for 5.6.14
Array Iteration :0.0153 SPL Iteration :0.038
Output for 5.6.13
Array Iteration :0.0143 SPL Iteration :0.0335
Output for 5.6.12
Array Iteration :0.0124 SPL Iteration :0.0301
Output for 5.6.11
Array Iteration :0.016 SPL Iteration :0.0235
Output for 5.6.10
Array Iteration :0.0166 SPL Iteration :0.0329
Output for 5.6.9
Array Iteration :0.0178 SPL Iteration :0.0337
Output for 5.6.8
Array Iteration :0.0144 SPL Iteration :0.0321
Output for 5.5.35
Array Iteration :0.0154 SPL Iteration :0.0237
Output for 5.5.34
Array Iteration :0.0134 SPL Iteration :0.0238
Output for 5.5.33
Array Iteration :0.0153 SPL Iteration :0.024
Output for 5.5.32
Array Iteration :0.02 SPL Iteration :0.0237
Output for 5.5.31
Array Iteration :0.0156 SPL Iteration :0.0242
Output for 5.5.30
Array Iteration :0.014 SPL Iteration :0.0231
Output for 5.5.29
Array Iteration :0.0167 SPL Iteration :0.0246
Output for 5.5.28
Array Iteration :0.015 SPL Iteration :0.0233
Output for 5.5.27
Array Iteration :0.0177 SPL Iteration :0.0254
Output for 5.5.26
Array Iteration :0.0173 SPL Iteration :0.025
Output for 5.5.25
Array Iteration :0.0145 SPL Iteration :0.0237
Output for 5.5.24
Array Iteration :0.0117 SPL Iteration :0.0198
Output for 5.4.45
Array Iteration :0.0212 SPL Iteration :0.0327
Output for 5.4.44
Array Iteration :0.044 SPL Iteration :0.0344
Output for 5.4.43
Array Iteration :0.0197 SPL Iteration :0.0318
Output for 5.4.42
Array Iteration :0.0215 SPL Iteration :0.0531
Output for 5.4.41
Array Iteration :0.0314 SPL Iteration :0.0338
Output for 5.4.40
Array Iteration :0.0558 SPL Iteration :0.0405
Output for 5.4.39
Array Iteration :0.034 SPL Iteration :0.0628
Output for 5.4.38
Array Iteration :0.0259 SPL Iteration :0.0511
Output for 5.4.37
Array Iteration :0.0209 SPL Iteration :0.0327
Output for 5.4.36
Array Iteration :0.0221 SPL Iteration :0.0319
Output for 5.4.35
Array Iteration :0.0216 SPL Iteration :0.0317
Output for 5.4.34
Array Iteration :0.0221 SPL Iteration :0.0368
Output for 5.4.32
Array Iteration :0.0149 SPL Iteration :0.0241
Output for 5.4.31
Array Iteration :0.0149 SPL Iteration :0.0252
Output for 5.4.30
Array Iteration :0.0172 SPL Iteration :0.0273
Output for 5.4.29
Array Iteration :0.0171 SPL Iteration :0.0252
Output for 5.4.28
Array Iteration :0.0161 SPL Iteration :0.0249
Output for 5.4.27
Array Iteration :0.0176 SPL Iteration :0.0286
Output for 5.4.26
Array Iteration :0.016 SPL Iteration :0.0264
Output for 5.4.25
Array Iteration :0.0233 SPL Iteration :0.0348
Output for 5.4.24
Array Iteration :0.0159 SPL Iteration :0.0277
Output for 5.4.23
Array Iteration :0.016 SPL Iteration :0.025
Output for 5.4.22
Array Iteration :0.0163 SPL Iteration :0.0249
Output for 5.4.21
Array Iteration :0.0153 SPL Iteration :0.025
Output for 5.4.20
Array Iteration :0.0164 SPL Iteration :0.0253
Output for 5.4.19
Array Iteration :0.016 SPL Iteration :0.0251
Output for 5.4.18
Array Iteration :0.0156 SPL Iteration :0.0246
Output for 5.4.17
Array Iteration :0.0152 SPL Iteration :0.0266
Output for 5.4.16
Array Iteration :0.0159 SPL Iteration :0.0267
Output for 5.4.15
Array Iteration :0.0162 SPL Iteration :0.0256
Output for 5.4.14
Array Iteration :0.0162 SPL Iteration :0.0246
Output for 5.4.13
Array Iteration :0.0169 SPL Iteration :0.0273
Output for 5.4.12
Array Iteration :0.016 SPL Iteration :0.0257
Output for 5.4.11
Array Iteration :0.0154 SPL Iteration :0.0253
Output for 5.4.10
Array Iteration :0.0236 SPL Iteration :0.0262
Output for 5.4.9
Array Iteration :0.0159 SPL Iteration :0.0263
Output for 5.4.8
Array Iteration :0.0156 SPL Iteration :0.0265
Output for 5.4.7
Array Iteration :0.0172 SPL Iteration :0.0292
Output for 5.4.6
Array Iteration :0.0162 SPL Iteration :0.0311
Output for 5.4.5
Array Iteration :0.0168 SPL Iteration :0.0262
Output for 5.4.4
Array Iteration :0.0158 SPL Iteration :0.0254
Output for 5.4.3
Array Iteration :0.016 SPL Iteration :0.0263
Output for 5.4.2
Array Iteration :0.0157 SPL Iteration :0.0266
Output for 5.4.1
Array Iteration :0.0158 SPL Iteration :0.0252
Output for 5.4.0
Array Iteration :0.0161 SPL Iteration :0.0261
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Cn6T3 on line 4
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/Cn6T3 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Cn6T3 on line 4
Process exited with code 255.