3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=10000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10000; $i++) { $classmap2['b'.$i] = $i+1; } $startTimeForeach = microtime(true); foreach ($classmap2 as $k => $v) { $classmap1[$k] = $v; } $endTimeForeach = microtime(true); echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n";
Output for 7.1.0
Foreach took 0.60081481933594 microseconds<br />
Output for 7.0.14
Foreach took 0.61893463134766 microseconds<br />
Output for 7.0.10
Foreach took 0.82707405090332 microseconds<br />
Output for 7.0.9
Foreach took 0.74505805969238 microseconds<br />
Output for 7.0.8
Foreach took 0.79488754272461 microseconds<br />
Output for 7.0.7
Foreach took 1.0268688201904 microseconds<br />
Output for 7.0.6
Foreach took 0.92291831970215 microseconds<br />
Output for 7.0.5
Foreach took 1.0550022125244 microseconds<br />
Output for 7.0.4
Foreach took 0.61607360839844 microseconds<br />
Output for 7.0.3
Foreach took 0.51379203796387 microseconds<br />
Output for 7.0.2
Foreach took 0.60296058654785 microseconds<br />
Output for 7.0.1
Foreach took 0.65994262695312 microseconds<br />
Output for 7.0.0
Foreach took 0.62394142150879 microseconds<br />
Output for 5.6.28
Foreach took 2.5341510772705 microseconds<br />
Output for 5.6.25
Foreach took 2.1209716796875 microseconds<br />
Output for 5.6.24
Foreach took 1.8579959869385 microseconds<br />
Output for 5.6.23
Foreach took 2.4900436401367 microseconds<br />
Output for 5.6.22
Foreach took 2.5219917297363 microseconds<br />
Output for 5.6.21
Foreach took 1.9080638885498 microseconds<br />
Output for 5.6.20
Foreach took 2.8979778289795 microseconds<br />
Output for 5.6.19
Foreach took 2.6481151580811 microseconds<br />
Output for 5.6.18
Foreach took 2.5539398193359 microseconds<br />
Output for 5.1.1, 5.6.17
Foreach took 2.4020671844482 microseconds<br />
Output for 5.6.16
Foreach took 2.3760795593262 microseconds<br />
Output for 5.6.15
Foreach took 2.3629665374756 microseconds<br />
Output for 5.6.14
Foreach took 2.4571418762207 microseconds<br />
Output for 5.6.13
Foreach took 2.4049282073975 microseconds<br />
Output for 5.6.12
Foreach took 2.5608539581299 microseconds<br />
Output for 5.6.11
Foreach took 2.1121501922607 microseconds<br />
Output for 5.3.11, 5.3.14, 5.6.10
Foreach took 2.8939247131348 microseconds<br />
Output for 5.6.9
Foreach took 2.5269985198975 microseconds<br />
Output for 5.6.8
Foreach took 2.2380352020264 microseconds<br />
Output for 5.6.7
Foreach took 2.3398399353027 microseconds<br />
Output for 5.6.6
Foreach took 2.4080276489258 microseconds<br />
Output for 5.6.5
Foreach took 2.0861625671387 microseconds<br />
Output for 5.6.4
Foreach took 1.9650459289551 microseconds<br />
Output for 5.6.3
Foreach took 2.2768974304199 microseconds<br />
Output for 5.6.2
Foreach took 2.6049613952637 microseconds<br />
Output for 5.6.1
Foreach took 2.3479461669922 microseconds<br />
Output for 5.6.0
Foreach took 2.2790431976318 microseconds<br />
Output for 5.5.38
Foreach took 2.3179054260254 microseconds<br />
Output for 5.5.37
Foreach took 1.8939971923828 microseconds<br />
Output for 5.5.36
Foreach took 2.6600360870361 microseconds<br />
Output for 5.5.35
Foreach took 1.7740726470947 microseconds<br />
Output for 5.5.34
Foreach took 2.6569366455078 microseconds<br />
Output for 5.5.33
Foreach took 2.7389526367188 microseconds<br />
Output for 5.5.32
Foreach took 2.6211738586426 microseconds<br />
Output for 5.4.13, 5.5.31
Foreach took 2.3860931396484 microseconds<br />
Output for 5.5.30
Foreach took 2.9468536376953 microseconds<br />
Output for 5.5.29
Foreach took 2.8018951416016 microseconds<br />
Output for 5.5.28
Foreach took 2.4611949920654 microseconds<br />
Output for 5.4.35, 5.5.27
Foreach took 2.4981498718262 microseconds<br />
Output for 5.5.26
Foreach took 2.2709369659424 microseconds<br />
Output for 5.5.25
Foreach took 2.284049987793 microseconds<br />
Output for 5.5.24
Foreach took 2.2330284118652 microseconds<br />
Output for 5.5.23
Foreach took 2.2799968719482 microseconds<br />
Output for 5.5.22
Foreach took 2.8140544891357 microseconds<br />
Output for 5.5.21
Foreach took 2.6381015777588 microseconds<br />
Output for 5.5.20
Foreach took 2.0711421966553 microseconds<br />
Output for 5.5.19
Foreach took 2.4440288543701 microseconds<br />
Output for 5.5.18
Foreach took 2.4528503417969 microseconds<br />
Output for 5.5.16
Foreach took 2.6400089263916 microseconds<br />
Output for 5.5.15
Foreach took 2.7110576629639 microseconds<br />
Output for 5.5.14
Foreach took 2.4740695953369 microseconds<br />
Output for 5.5.13
Foreach took 2.1400451660156 microseconds<br />
Output for 5.5.12
Foreach took 2.5479793548584 microseconds<br />
Output for 5.5.11
Foreach took 2.5570392608643 microseconds<br />
Output for 5.5.10
Foreach took 2.5551319122314 microseconds<br />
Output for 5.5.9
Foreach took 1.9898414611816 microseconds<br />
Output for 5.5.8
Foreach took 2.2821426391602 microseconds<br />
Output for 5.5.7
Foreach took 2.3109912872314 microseconds<br />
Output for 5.5.6
Foreach took 2.2718906402588 microseconds<br />
Output for 5.5.5
Foreach took 2.4631023406982 microseconds<br />
Output for 5.5.4
Foreach took 2.8488636016846 microseconds<br />
Output for 5.5.3
Foreach took 2.0351409912109 microseconds<br />
Output for 5.5.2
Foreach took 1.8410682678223 microseconds<br />
Output for 5.5.1
Foreach took 2.363920211792 microseconds<br />
Output for 5.5.0
Foreach took 2.2590160369873 microseconds<br />
Output for 5.4.45
Foreach took 2.7849674224854 microseconds<br />
Output for 5.4.44
Foreach took 2.2339820861816 microseconds<br />
Output for 5.4.43
Foreach took 2.8510093688965 microseconds<br />
Output for 5.4.42
Foreach took 2.5668144226074 microseconds<br />
Output for 5.4.41
Foreach took 2.6521682739258 microseconds<br />
Output for 5.4.40
Foreach took 2.1259784698486 microseconds<br />
Output for 5.4.39
Foreach took 2.6180744171143 microseconds<br />
Output for 5.4.38
Foreach took 2.6960372924805 microseconds<br />
Output for 5.4.37
Foreach took 2.626895904541 microseconds<br />
Output for 5.4.36
Foreach took 2.5930404663086 microseconds<br />
Output for 5.4.34
Foreach took 3.2789707183838 microseconds<br />
Output for 5.4.32
Foreach took 2.6288032531738 microseconds<br />
Output for 5.4.31
Foreach took 2.3839473724365 microseconds<br />
Output for 5.4.30
Foreach took 2.6659965515137 microseconds<br />
Output for 5.4.29
Foreach took 2.946138381958 microseconds<br />
Output for 5.4.28
Foreach took 2.95090675354 microseconds<br />
Output for 5.4.27
Foreach took 2.6741027832031 microseconds<br />
Output for 5.4.26
Foreach took 2.6640892028809 microseconds<br />
Output for 5.4.25
Foreach took 2.1440982818604 microseconds<br />
Output for 5.4.24
Foreach took 3.0081272125244 microseconds<br />
Output for 5.4.23
Foreach took 1.9071102142334 microseconds<br />
Output for 5.4.22
Foreach took 2.3751258850098 microseconds<br />
Output for 5.4.21
Foreach took 2.457857131958 microseconds<br />
Output for 5.4.20
Foreach took 2.1090507507324 microseconds<br />
Output for 5.4.19
Foreach took 2.2368431091309 microseconds<br />
Output for 5.4.18
Foreach took 1.9419193267822 microseconds<br />
Output for 5.4.17
Foreach took 2.6528835296631 microseconds<br />
Output for 5.4.16
Foreach took 2.7339458465576 microseconds<br />
Output for 5.4.15
Foreach took 2.4590492248535 microseconds<br />
Output for 5.4.14
Foreach took 2.0360946655273 microseconds<br />
Output for 5.4.12
Foreach took 2.8059482574463 microseconds<br />
Output for 5.4.11
Foreach took 3.1580924987793 microseconds<br />
Output for 5.4.10
Foreach took 2.0408630371094 microseconds<br />
Output for 5.4.9
Foreach took 2.8700828552246 microseconds<br />
Output for 5.4.8
Foreach took 2.3560523986816 microseconds<br />
Output for 5.4.7
Foreach took 2.8188228607178 microseconds<br />
Output for 5.4.6
Foreach took 2.4788379669189 microseconds<br />
Output for 5.4.5
Foreach took 2.507209777832 microseconds<br />
Output for 5.4.4
Foreach took 2.4609565734863 microseconds<br />
Output for 5.4.3
Foreach took 2.2540092468262 microseconds<br />
Output for 5.4.2
Foreach took 2.8049945831299 microseconds<br />
Output for 5.4.1
Foreach took 2.4888515472412 microseconds<br />
Output for 5.4.0
Foreach took 2.9621124267578 microseconds<br />
Output for 5.3.29
Foreach took 2.1960735321045 microseconds<br />
Output for 5.3.28
Foreach took 2.7730464935303 microseconds<br />
Output for 5.3.27
Foreach took 2.9051303863525 microseconds<br />
Output for 5.3.26
Foreach took 2.608060836792 microseconds<br />
Output for 5.3.25
Foreach took 2.7000904083252 microseconds<br />
Output for 5.3.24
Foreach took 2.687931060791 microseconds<br />
Output for 5.3.23
Foreach took 2.4378299713135 microseconds<br />
Output for 5.3.22
Foreach took 2.6910305023193 microseconds<br />
Output for 5.3.21
Foreach took 2.6669502258301 microseconds<br />
Output for 5.3.20
Foreach took 2.7279853820801 microseconds<br />
Output for 5.3.19
Foreach took 1.8379688262939 microseconds<br />
Output for 5.3.18
Foreach took 2.9101371765137 microseconds<br />
Output for 5.3.13, 5.3.17
Foreach took 2.683162689209 microseconds<br />
Output for 5.3.16
Foreach took 3.0121803283691 microseconds<br />
Output for 5.3.15
Foreach took 1.8820762634277 microseconds<br />
Output for 5.3.12
Foreach took 2.7151107788086 microseconds<br />
Output for 5.3.10
Foreach took 2.9339790344238 microseconds<br />
Output for 5.3.9
Foreach took 2.7601718902588 microseconds<br />
Output for 5.3.8
Foreach took 2.9559135437012 microseconds<br />
Output for 5.3.7
Foreach took 2.7248859405518 microseconds<br />
Output for 5.3.6
Foreach took 2.8610229492188 microseconds<br />
Output for 5.3.5
Foreach took 2.7701854705811 microseconds<br />
Output for 5.3.4
Foreach took 2.0990371704102 microseconds<br />
Output for 5.3.3
Foreach took 1.9848346710205 microseconds<br />
Output for 5.3.2
Foreach took 1.8830299377441 microseconds<br />
Output for 5.3.1
Foreach took 1.5411376953125 microseconds<br />
Output for 5.3.0
Foreach took 2.1929740905762 microseconds<br />
Output for 5.2.17
Foreach took 2.1920204162598 microseconds<br />
Output for 5.2.16
Foreach took 2.5649070739746 microseconds<br />
Output for 5.2.15
Foreach took 2.2168159484863 microseconds<br />
Output for 5.2.14
Foreach took 2.6440620422363 microseconds<br />
Output for 5.2.13
Foreach took 2.345085144043 microseconds<br />
Output for 5.2.12
Foreach took 2.2029876708984 microseconds<br />
Output for 5.2.11
Foreach took 1.6829967498779 microseconds<br />
Output for 5.2.10
Foreach took 2.2211074829102 microseconds<br />
Output for 5.2.9
Foreach took 2.0420551300049 microseconds<br />
Output for 5.2.8
Foreach took 2.241849899292 microseconds<br />
Output for 5.2.7
Foreach took 2.4919509887695 microseconds<br />
Output for 5.2.6
Foreach took 2.0439624786377 microseconds<br />
Output for 5.2.5
Foreach took 3.2708644866943 microseconds<br />
Output for 5.2.4
Foreach took 2.4209022521973 microseconds<br />
Output for 5.2.3
Foreach took 2.7611255645752 microseconds<br />
Output for 5.2.2
Foreach took 2.5911331176758 microseconds<br />
Output for 5.2.1
Foreach took 1.9481182098389 microseconds<br />
Output for 5.2.0
Foreach took 1.9340515136719 microseconds<br />
Output for 5.1.6
Foreach took 2.3939609527588 microseconds<br />
Output for 5.1.5
Foreach took 2.3829936981201 microseconds<br />
Output for 5.1.4
Foreach took 2.1240711212158 microseconds<br />
Output for 5.1.3
Foreach took 2.4499893188477 microseconds<br />
Output for 5.1.2
Foreach took 4.1649341583252 microseconds<br />
Output for 5.1.0
Foreach took 2.2609233856201 microseconds<br />
Output for 5.0.5
Foreach took 4.6179294586182 microseconds<br />
Output for 5.0.4
Foreach took 4.5721530914307 microseconds<br />
Output for 5.0.3
Foreach took 5.1748752593994 microseconds<br />
Output for 5.0.2
Foreach took 5.2318572998047 microseconds<br />
Output for 5.0.1
Foreach took 6.1488151550293 microseconds<br />
Output for 5.0.0
Foreach took 4.4679641723633 microseconds<br />
Output for 4.4.9
Foreach took 4.267 microseconds<br />
Output for 4.4.8
Foreach took 6.703 microseconds<br />
Output for 4.4.7
Foreach took 5.541 microseconds<br />
Output for 4.4.6
Foreach took 10.004 microseconds<br />
Output for 4.4.5
Foreach took 4.75 microseconds<br />
Output for 4.4.4
Foreach took 6.416 microseconds<br />
Output for 4.4.3
Foreach took 5.55 microseconds<br />
Output for 4.4.2
Foreach took 6.62 microseconds<br />
Output for 4.4.1
Foreach took 4.863 microseconds<br />
Output for 4.4.0
Foreach took 5.558 microseconds<br />
Output for 4.3.11
Foreach took 6.927 microseconds<br />
Output for 4.3.10
Foreach took 5.049 microseconds<br />
Output for 4.3.9
Foreach took 5.858 microseconds<br />
Output for 4.3.8
Foreach took 5.074 microseconds<br />
Output for 4.3.7
Foreach took 8.438 microseconds<br />
Output for 4.3.6
Foreach took 4.833 microseconds<br />
Output for 4.3.5
Foreach took 5.249 microseconds<br />
Output for 4.3.4
Foreach took 5.817 microseconds<br />
Output for 4.3.3
Foreach took 6.782 microseconds<br />
Output for 4.3.2
Foreach took 5.054 microseconds<br />
Output for 4.3.1
Foreach took 5.498 microseconds<br />
Output for 4.3.0
Foreach took 9.983 microseconds<br />