3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $test = []; for($i = 0; $i < 100000; $i++) { $test[] = $i; } $start_t = microtime(true); for($i = 0; $i<count($test); $i++) { $test[$i] += $i; } echo 'Time with count: '.(microtime(true) - $start_t).PHP_EOL; $start_t = microtime(true); $count = count($test); for($i = 0; $i<$count; $i++) { $test[$i] += $i; } echo 'Time without count: '.(microtime(true) - $start_t).PHP_EOL; $start_t = microtime(true); foreach($test as $i => $val) { $test[$i] += $i; } echo 'Time with foreach: '.(microtime(true) - $start_t).PHP_EOL;
Output for 7.1.0
Time with count: 0.0058219432830811 Time without count: 0.0033979415893555 Time with foreach: 0.0048630237579346
Output for 7.0.14
Time with count: 0.0061910152435303 Time without count: 0.0058779716491699 Time with foreach: 0.005195140838623
Output for 7.0.10
Time with count: 0.0039529800415039 Time without count: 0.0025219917297363 Time with foreach: 0.0048520565032959
Output for 7.0.9
Time with count: 0.0046970844268799 Time without count: 0.0023338794708252 Time with foreach: 0.021100997924805
Output for 7.0.8
Time with count: 0.0036630630493164 Time without count: 0.002202033996582 Time with foreach: 0.0038318634033203
Output for 7.0.7
Time with count: 0.0054230690002441 Time without count: 0.0032799243927002 Time with foreach: 0.0052108764648438
Output for 7.0.6
Time with count: 0.004472017288208 Time without count: 0.0026600360870361 Time with foreach: 0.0045721530914307
Output for 7.0.5
Time with count: 0.0054950714111328 Time without count: 0.0031900405883789 Time with foreach: 0.0057880878448486
Output for 7.0.4
Time with count: 0.0057220458984375 Time without count: 0.0035889148712158 Time with foreach: 0.005640983581543
Output for 7.0.3
Time with count: 0.0051848888397217 Time without count: 0.0031208992004395 Time with foreach: 0.0062448978424072
Output for 7.0.2
Time with count: 0.0046191215515137 Time without count: 0.002810001373291 Time with foreach: 0.041009902954102
Output for 7.0.1
Time with count: 0.0036377906799316 Time without count: 0.002161979675293 Time with foreach: 0.003777027130127
Output for 7.0.0
Time with count: 0.0064060688018799 Time without count: 0.0039131641387939 Time with foreach: 0.0054638385772705
Output for 5.6.28
Time with count: 0.017445802688599 Time without count: -0.0031111240386963 Time with foreach: -0.024188995361328
Output for 5.6.25
Time with count: 0.014522075653076 Time without count: 0.0059828758239746 Time with foreach: 0.022523164749146
Output for 5.6.24
Time with count: 0.012403964996338 Time without count: 0.005544900894165 Time with foreach: 0.019860982894897
Output for 5.6.23
Time with count: 0.014334917068481 Time without count: 0.0048460960388184 Time with foreach: 0.019243955612183
Output for 5.6.22
Time with count: 0.011828899383545 Time without count: 0.0052239894866943 Time with foreach: 0.01883602142334
Output for 5.6.21
Time with count: 0.024367094039917 Time without count: 0.010425806045532 Time with foreach: 0.03361988067627
Output for 5.6.20
Time with count: 0.016010999679565 Time without count: 0.0056979656219482 Time with foreach: 0.021994113922119
Output for 5.6.19
Time with count: 0.014103889465332 Time without count: 0.0059299468994141 Time with foreach: 0.022531986236572
Output for 5.6.18
Time with count: 0.019296169281006 Time without count: 0.0069599151611328 Time with foreach: 0.025875806808472
Output for 5.6.17
Time with count: 0.011332988739014 Time without count: 0.0046710968017578 Time with foreach: 0.019423961639404
Output for 5.6.16
Time with count: 0.016121864318848 Time without count: 0.0049378871917725 Time with foreach: 0.018970966339111
Output for 5.6.15
Time with count: 0.014729022979736 Time without count: 0.0047080516815186 Time with foreach: 0.019474029541016
Output for 5.6.14
Time with count: 0.014249086380005 Time without count: 0.0059108734130859 Time with foreach: 0.022560834884644
Output for 5.6.13
Time with count: 0.013871192932129 Time without count: 0.0055711269378662 Time with foreach: 0.021382093429565
Output for 5.6.12
Time with count: 0.014677047729492 Time without count: 0.0070259571075439 Time with foreach: 0.024490118026733
Output for 5.6.11
Time with count: 0.013144016265869 Time without count: 0.0055220127105713 Time with foreach: 0.020697832107544
Output for 5.6.10
Time with count: 0.013463020324707 Time without count: 0.0056991577148438 Time with foreach: 0.021569967269897
Output for 5.6.9
Time with count: 0.012763023376465 Time without count: 0.0052690505981445 Time with foreach: 0.020303010940552
Output for 5.6.8
Time with count: 0.01220703125 Time without count: 0.0050008296966553 Time with foreach: 0.019919157028198
Output for 5.6.7
Time with count: 0.014036178588867 Time without count: 0.0054230690002441 Time with foreach: 0.020380020141602
Output for 5.6.6
Time with count: 0.012862920761108 Time without count: 0.0056488513946533 Time with foreach: 0.024451971054077
Output for 5.6.5
Time with count: 0.01147985458374 Time without count: 0.0047039985656738 Time with foreach: 0.019654989242554
Output for 5.6.4
Time with count: 0.013436079025269 Time without count: 0.0061988830566406 Time with foreach: 0.021527051925659
Output for 5.6.3
Time with count: 0.01512598991394 Time without count: 0.0058290958404541 Time with foreach: 0.021590948104858
Output for 5.6.2
Time with count: 0.011297941207886 Time without count: 0.0049998760223389 Time with foreach: 0.019104957580566
Output for 5.6.1
Time with count: 0.014004945755005 Time without count: 0.0059690475463867 Time with foreach: 0.021870136260986
Output for 5.6.0
Time with count: 0.011182069778442 Time without count: 0.0047411918640137 Time with foreach: 0.019104957580566
Output for 5.5.38
Time with count: 0.012763977050781 Time without count: 0.0054080486297607 Time with foreach: 0.019399166107178
Output for 5.5.37
Time with count: 0.015895843505859 Time without count: 0.0051968097686768 Time with foreach: 0.020519971847534
Output for 5.5.36
Time with count: 0.013710021972656 Time without count: 0.0052359104156494 Time with foreach: 0.020209074020386
Output for 5.5.35
Time with count: 0.012314796447754 Time without count: 0.0052230358123779 Time with foreach: 0.019855976104736
Output for 5.5.34
Time with count: 0.014348983764648 Time without count: 0.0049669742584229 Time with foreach: 0.020094156265259
Output for 5.5.33
Time with count: 0.012056827545166 Time without count: 0.0050439834594727 Time with foreach: 0.019286155700684
Output for 5.5.32
Time with count: 0.01173210144043 Time without count: 0.0058879852294922 Time with foreach: 0.021056175231934
Output for 5.5.31
Time with count: 0.015641927719116 Time without count: 0.0060980319976807 Time with foreach: 0.022931814193726
Output for 5.5.30
Time with count: 0.013752222061157 Time without count: 0.005687952041626 Time with foreach: 0.026081085205078
Output for 5.5.29
Time with count: 0.017242193222046 Time without count: 0.0070610046386719 Time with foreach: 0.025334119796753
Output for 5.5.28
Time with count: 0.01225209236145 Time without count: 0.0051028728485107 Time with foreach: 0.021960973739624
Output for 5.5.27
Time with count: 0.013513088226318 Time without count: 0.0055890083312988 Time with foreach: 0.021248817443848
Output for 5.5.26
Time with count: 0.014872074127197 Time without count: 0.0058879852294922 Time with foreach: 0.021130800247192
Output for 5.5.25
Time with count: 0.016023874282837 Time without count: 0.0062739849090576 Time with foreach: 0.022791147232056
Output for 5.5.24
Time with count: 0.014868021011353 Time without count: 0.0058431625366211 Time with foreach: 0.019957065582275
Output for 5.5.23
Time with count: 0.01488208770752 Time without count: 0.0057501792907715 Time with foreach: 0.021438837051392
Output for 5.5.22
Time with count: 0.016771078109741 Time without count: 0.006566047668457 Time with foreach: 0.024439096450806
Output for 5.5.21
Time with count: 0.01749587059021 Time without count: 0.0067999362945557 Time with foreach: 0.024389982223511
Output for 5.5.20
Time with count: 0.014094829559326 Time without count: 0.004802942276001 Time with foreach: 0.020360946655273
Output for 5.5.19
Time with count: 0.02360987663269 Time without count: 0.0085508823394775 Time with foreach: 0.029615163803101
Output for 5.5.18
Time with count: 0.011531829833984 Time without count: 0.0048141479492188 Time with foreach: 0.023422002792358
Output for 5.5.16
Time with count: 0.017575025558472 Time without count: 0.0069141387939453 Time with foreach: 0.025657892227173
Output for 5.5.15
Time with count: 0.015328168869019 Time without count: 0.0056309700012207 Time with foreach: 0.024478912353516
Output for 5.5.14
Time with count: 0.015130043029785 Time without count: 0.0060629844665527 Time with foreach: 0.023000955581665
Output for 5.5.13
Time with count: 0.01465106010437 Time without count: 0.0058341026306152 Time with foreach: 0.021077156066895
Output for 5.5.12
Time with count: 0.015197992324829 Time without count: 0.0062241554260254 Time with foreach: 0.021292924880981
Output for 5.5.11
Time with count: 0.014586925506592 Time without count: 0.0048930644989014 Time with foreach: 0.021149158477783
Output for 5.5.10
Time with count: 0.016339063644409 Time without count: 0.0070350170135498 Time with foreach: 0.023830890655518
Output for 5.5.9
Time with count: 0.015699863433838 Time without count: 0.0057871341705322 Time with foreach: 0.024511098861694
Output for 5.5.8
Time with count: 0.014673233032227 Time without count: 0.006134033203125 Time with foreach: 0.023123025894165
Output for 5.5.7
Time with count: 0.016528129577637 Time without count: 0.0059990882873535 Time with foreach: 0.023491144180298
Output for 5.5.6
Time with count: 0.012030839920044 Time without count: 0.0046448707580566 Time with foreach: 0.019046068191528
Output for 5.5.5
Time with count: 0.014726877212524 Time without count: 0.0045421123504639 Time with foreach: 0.019579887390137
Output for 5.5.4
Time with count: 0.011401891708374 Time without count: 0.004831075668335 Time with foreach: 0.018317937850952
Output for 5.5.3
Time with count: 0.011543989181519 Time without count: 0.00484299659729 Time with foreach: 0.0187668800354
Output for 5.5.2
Time with count: 0.011735916137695 Time without count: 0.0049800872802734 Time with foreach: 0.018532037734985
Output for 5.5.1
Time with count: 0.011619091033936 Time without count: 0.0049140453338623 Time with foreach: 0.018588066101074
Output for 5.5.0
Time with count: 0.018676996231079 Time without count: 0.0069191455841064 Time with foreach: 0.024621963500977
Output for 5.4.45
Time with count: 0.015192031860352 Time without count: 0.0055058002471924 Time with foreach: 0.024255990982056
Output for 5.4.44
Time with count: 0.012495994567871 Time without count: 0.0048871040344238 Time with foreach: 0.019096851348877
Output for 5.4.43
Time with count: 0.0172278881073 Time without count: 0.006770133972168 Time with foreach: 0.025851964950562
Output for 5.4.42
Time with count: 0.021407127380371 Time without count: 0.0058901309967041 Time with foreach: 0.02154803276062
Output for 5.4.41
Time with count: 0.014626026153564 Time without count: 0.0060279369354248 Time with foreach: 0.022508859634399
Output for 5.4.40
Time with count: 0.018826007843018 Time without count: 0.0068099498748779 Time with foreach: 0.025696039199829
Output for 5.4.39
Time with count: 0.016118049621582 Time without count: 0.0062251091003418 Time with foreach: 0.023854970932007
Output for 5.4.38
Time with count: 0.016048908233643 Time without count: 0.0058681964874268 Time with foreach: 0.023228168487549
Output for 5.4.37
Time with count: 0.012136936187744 Time without count: 0.005134105682373 Time with foreach: 0.020933151245117
Output for 5.4.36
Time with count: 0.013079881668091 Time without count: 0.0055649280548096 Time with foreach: 0.020397186279297
Output for 5.4.35
Time with count: 0.015202045440674 Time without count: 0.0061931610107422 Time with foreach: 0.023494958877563
Output for 5.4.34
Time with count: 0.016248941421509 Time without count: 0.0066390037536621 Time with foreach: 0.024957895278931
Output for 5.4.32
Time with count: 0.011522054672241 Time without count: 0.0047531127929688 Time with foreach: 0.01953911781311
Output for 5.4.31
Time with count: 0.013710975646973 Time without count: 0.005795955657959 Time with foreach: 0.022090911865234
Output for 5.4.30
Time with count: 0.014110088348389 Time without count: 0.0056710243225098 Time with foreach: 0.019961833953857
Output for 5.4.29
Time with count: 0.013212919235229 Time without count: 0.0054478645324707 Time with foreach: 0.021190166473389
Output for 5.4.28
Time with count: 0.016381025314331 Time without count: 0.0058810710906982 Time with foreach: 0.021682024002075
Output for 5.4.27
Time with count: 0.016674041748047 Time without count: 0.0056819915771484 Time with foreach: 0.021223068237305
Output for 5.4.26
Time with count: 0.015988826751709 Time without count: 0.0052990913391113 Time with foreach: 0.022512912750244
Output for 5.4.25
Time with count: 0.012784957885742 Time without count: 0.005518913269043 Time with foreach: 0.026744842529297
Output for 5.4.24
Time with count: 0.012280941009521 Time without count: 0.0047359466552734 Time with foreach: 0.019858837127686
Output for 5.4.23
Time with count: 0.016768932342529 Time without count: 0.0066549777984619 Time with foreach: 0.028913974761963
Output for 5.4.22
Time with count: 0.011714935302734 Time without count: 0.0049781799316406 Time with foreach: 0.018550872802734
Output for 5.4.21
Time with count: 0.011554002761841 Time without count: 0.0050530433654785 Time with foreach: 0.018908023834229
Output for 5.4.20
Time with count: 0.011298179626465 Time without count: 0.0049808025360107 Time with foreach: 0.01866602897644
Output for 5.4.19
Time with count: 0.01200795173645 Time without count: 0.0050549507141113 Time with foreach: 0.018815994262695
Output for 5.4.18
Time with count: 0.011419057846069 Time without count: 0.0046961307525635 Time with foreach: 0.018253087997437
Output for 5.4.17
Time with count: 0.013797044754028 Time without count: 0.0048789978027344 Time with foreach: 0.019345998764038
Output for 5.4.16
Time with count: 0.011749982833862 Time without count: 0.0049622058868408 Time with foreach: 0.019117832183838
Output for 5.4.15
Time with count: 0.016094207763672 Time without count: 0.0065901279449463 Time with foreach: 0.022548913955688
Output for 5.4.14
Time with count: 0.012403964996338 Time without count: 0.005126953125 Time with foreach: 0.018391132354736
Output for 5.4.13
Time with count: 0.013545036315918 Time without count: 0.0054821968078613 Time with foreach: 0.018929004669189
Output for 5.4.12
Time with count: 0.011766910552979 Time without count: 0.0053250789642334 Time with foreach: 0.019807100296021
Output for 5.4.11
Time with count: 0.013222217559814 Time without count: 0.005486011505127 Time with foreach: 0.019392967224121
Output for 5.4.10
Time with count: 0.011675834655762 Time without count: 0.0046670436859131 Time with foreach: 0.020452976226807
Output for 5.4.9
Time with count: 0.011713027954102 Time without count: 0.0047509670257568 Time with foreach: 0.018976926803589
Output for 5.4.8
Time with count: 0.011281967163086 Time without count: 0.0047330856323242 Time with foreach: 0.018736124038696
Output for 5.4.7
Time with count: 0.0119469165802 Time without count: 0.0048449039459229 Time with foreach: 0.019145011901855
Output for 5.4.6
Time with count: 0.013546943664551 Time without count: 0.0051541328430176 Time with foreach: 0.020445108413696
Output for 5.4.5
Time with count: 0.011386156082153 Time without count: 0.0046658515930176 Time with foreach: 0.018710851669312
Output for 5.4.4
Time with count: 0.011495113372803 Time without count: 0.0048160552978516 Time with foreach: 0.019046068191528
Output for 5.4.3
Time with count: 0.011043071746826 Time without count: 0.0047500133514404 Time with foreach: 0.018236875534058
Output for 5.4.2
Time with count: 0.012815952301025 Time without count: 0.0051019191741943 Time with foreach: 0.019706964492798
Output for 5.4.1
Time with count: 0.013722896575928 Time without count: 0.004835844039917 Time with foreach: 0.021420001983643
Output for 5.4.0
Time with count: 0.011492967605591 Time without count: 0.004845142364502 Time with foreach: 0.018083095550537
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/flAlb 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/flAlb on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/flAlb on line 3
Process exited with code 255.