3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test_1($nb) { $t = microtime(true); $a = 'f'; $t = microtime(true); $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { if ($a==='a') { $b .= $a; } else if ($a==='b') { $b .= $a; } else if ($a==='c') { $b .= $a; } else if ($a==='d') { $b .= $a; } else if ($a==='e') { $b .= $a; } else if ($a==='f') { $b .= $a; } } return (microtime(true) - $t); } function test_2($nb) { $a = 'f'; $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { switch ($a) { case 'a': $b .= $a; case 'b': $b .= $a; case 'c': $b .= $a; case 'd': $b .= $a; case 'e': $b .= $a; case 'f': $b .= $a; } } return (microtime(true) - $t); } $nb = 100000; echo 'test_1: '.test_1($nb)."\n"; echo 'test_2: '.test_2($nb)."\n";
Output for 7.1.0
test_1: 0.0078079700469971 test_2: 0.0065138339996338
Output for 7.0.14
test_1: 0.014926910400391 test_2: 0.012966871261597
Output for 7.0.11
test_1: 0.0072891712188721 test_2: 0.0060739517211914
Output for 7.0.10
test_1: 0.007282018661499 test_2: 0.0062789916992188
Output for 7.0.9
test_1: 0.0095319747924805 test_2: 0.010094881057739
Output for 7.0.8
test_1: 0.0092811584472656 test_2: 0.0079858303070068
Output for 7.0.7
test_1: 0.0091140270233154 test_2: 0.0087409019470215
Output for 7.0.6
test_1: 0.0087478160858154 test_2: 0.0075070858001709
Output for 7.0.5
test_1: 0.0092179775238037 test_2: 0.0079638957977295
Output for 7.0.4
test_1: 0.0098080635070801 test_2: 0.0074741840362549
Output for 7.0.3
test_1: 0.011378049850464 test_2: 0.0091230869293213
Output for 7.0.2
test_1: 0.0084261894226074 test_2: 0.0076630115509033
Output for 7.0.1
test_1: 0.0096879005432129 test_2: 0.0081310272216797
Output for 7.0.0
test_1: 0.011359930038452 test_2: 0.0092730522155762
Output for hhvm-3.13.2
test_1: 0.029834985733032 test_2: 0.046359062194824
Output for hhvm-3.12.0
test_1: 0.030860185623169 test_2: 0.031802892684937
Output for hhvm-3.10.0
test_1: 0.040853023529053 test_2: 0.046489953994751
Output for 5.6.28
test_1: 0.018109083175659 test_2: 0.02898907661438
Output for 5.6.25
test_1: 0.016175031661987 test_2: 0.025098085403442
Output for 5.6.24
test_1: 0.013487815856934 test_2: 0.024065971374512
Output for 5.6.23
test_1: 0.01672101020813 test_2: 0.023471832275391
Output for 5.6.22
test_1: 0.015382051467896 test_2: 0.023463010787964
Output for 5.6.21
test_1: 0.01589298248291 test_2: 0.02242112159729
Output for 5.6.20
test_1: 0.01434588432312 test_2: 0.021608114242554
Output for 5.6.19
test_1: 0.01478910446167 test_2: 0.019111156463623
Output for 5.6.18
test_1: 0.014174938201904 test_2: 0.023102998733521
Output for 5.6.17
test_1: 0.014249086380005 test_2: 0.021955966949463
Output for 5.6.16
test_1: 0.01404595375061 test_2: 0.021967887878418
Output for 5.6.15
test_1: 0.010773181915283 test_2: 0.019156932830811
Output for 5.6.14
test_1: 0.014770030975342 test_2: 0.022440195083618
Output for 5.6.13
test_1: 0.01353907585144 test_2: 0.019742965698242
Output for 5.6.12
test_1: 0.015494108200073 test_2: 0.020717144012451
Output for 5.6.11
test_1: 0.015171051025391 test_2: 0.020401954650879
Output for 5.6.10
test_1: 0.015765190124512 test_2: 0.021252870559692
Output for 5.6.9
test_1: 0.0172278881073 test_2: 0.025978088378906
Output for 5.6.8
test_1: 0.014296054840088 test_2: 0.022679090499878
Output for 5.6.7
test_1: 0.014577865600586 test_2: 0.023416996002197
Output for 5.6.6
test_1: 0.017114877700806 test_2: 0.02655816078186
Output for 5.6.5
test_1: 0.016937017440796 test_2: 0.02380895614624
Output for 5.6.4
test_1: 0.015326976776123 test_2: 0.022876977920532
Output for 5.6.3
test_1: 0.015516996383667 test_2: 0.01866602897644
Output for 5.6.2
test_1: 0.015550136566162 test_2: 0.02445912361145
Output for 5.6.1
test_1: 0.014817953109741 test_2: 0.023368835449219
Output for 5.6.0
test_1: 0.014085054397583 test_2: 0.019285917282104
Output for 5.5.38
test_1: 0.015050888061523 test_2: 0.023431062698364
Output for 5.5.37
test_1: 0.015871047973633 test_2: 0.022860050201416
Output for 5.5.36
test_1: 0.016756057739258 test_2: 0.02395486831665
Output for 5.5.35
test_1: 0.013123989105225 test_2: 0.020969152450562
Output for 5.5.34
test_1: 0.014467000961304 test_2: 0.020585060119629
Output for 5.5.33
test_1: 0.015885829925537 test_2: 0.021111011505127
Output for 5.5.32
test_1: 0.014187097549438 test_2: 0.019042015075684
Output for 5.5.31
test_1: 0.014152050018311 test_2: 0.021265983581543
Output for 5.5.30
test_1: 0.01668119430542 test_2: 0.024951934814453
Output for 5.5.29
test_1: 0.012208938598633 test_2: 0.019965887069702
Output for 5.5.28
test_1: 0.01607608795166 test_2: 0.026270151138306
Output for 5.5.27
test_1: 0.016736030578613 test_2: 0.022735118865967
Output for 5.5.26
test_1: 0.014495134353638 test_2: 0.023102998733521
Output for 5.5.25
test_1: 0.016262054443359 test_2: 0.02108907699585
Output for 5.5.24
test_1: 0.016786098480225 test_2: 0.026118993759155
Output for 5.5.23
test_1: 0.014410972595215 test_2: 0.020654201507568
Output for 5.5.22
test_1: 0.017956972122192 test_2: 0.023555994033813
Output for 5.5.21
test_1: 0.013365983963013 test_2: 0.021290063858032
Output for 5.5.20
test_1: 0.015442132949829 test_2: 0.019802093505859
Output for 5.5.19
test_1: 0.017190933227539 test_2: 0.026864051818848
Output for 5.5.18
test_1: 0.015994787216187 test_2: 0.024039030075073
Output for 5.5.16
test_1: 0.01685905456543 test_2: 0.025743007659912
Output for 5.5.15
test_1: 0.015624046325684 test_2: 0.020936012268066
Output for 5.5.14
test_1: 0.014894008636475 test_2: 0.023828029632568
Output for 5.5.13
test_1: 0.011621952056885 test_2: 0.019729852676392
Output for 5.5.12
test_1: 0.015882968902588 test_2: 0.02211594581604
Output for 5.5.11
test_1: 0.019078969955444 test_2: 0.025490999221802
Output for 5.5.10
test_1: 0.01531982421875 test_2: 0.024013042449951
Output for 5.5.9
test_1: 0.01718807220459 test_2: 0.025947093963623
Output for 5.5.8
test_1: 0.015688180923462 test_2: 0.022320985794067
Output for 5.5.7
test_1: 0.014922857284546 test_2: 0.019876003265381
Output for 5.5.6
test_1: 0.01659107208252 test_2: 0.022492170333862
Output for 5.5.5
test_1: 0.01741886138916 test_2: 0.02671217918396
Output for 5.5.4
test_1: 0.017014026641846 test_2: 0.024043083190918
Output for 5.5.3
test_1: 0.015341997146606 test_2: 0.023146867752075
Output for 5.5.2
test_1: 0.016088008880615 test_2: 0.024351119995117
Output for 5.5.1
test_1: 0.01400089263916 test_2: 0.020616769790649
Output for 5.5.0
test_1: 0.012706995010376 test_2: 0.020025968551636
Output for 5.4.45
test_1: 0.014190912246704 test_2: 0.020941019058228
Output for 5.4.44
test_1: 0.015752077102661 test_2: 0.02370810508728
Output for 5.4.43
test_1: 0.012799024581909 test_2: 0.019042015075684
Output for 5.4.42
test_1: 0.015108108520508 test_2: 0.023177862167358
Output for 5.4.41
test_1: 0.014157056808472 test_2: 0.018071889877319
Output for 5.4.40
test_1: 0.016680955886841 test_2: 0.025063037872314
Output for 5.4.39
test_1: 0.015879154205322 test_2: 0.02330207824707
Output for 5.4.38
test_1: 0.015233993530273 test_2: 0.02328896522522
Output for 5.4.37
test_1: 0.012975931167603 test_2: 0.022119998931885
Output for 5.4.36
test_1: 0.016000032424927 test_2: 0.025079011917114
Output for 5.4.35
test_1: 0.015655040740967 test_2: 0.023061990737915
Output for 5.4.34
test_1: 0.019240140914917 test_2: 0.026593923568726
Output for 5.4.32
test_1: 0.015904188156128 test_2: 0.02448582649231
Output for 5.4.31
test_1: 0.01705002784729 test_2: 0.026249885559082
Output for 5.4.30
test_1: 0.015944957733154 test_2: 0.023201942443848
Output for 5.4.29
test_1: 0.011631011962891 test_2: 0.016844987869263
Output for 5.4.28
test_1: 0.016795873641968 test_2: 0.025851964950562
Output for 5.4.27
test_1: 0.014188051223755 test_2: 0.018996953964233
Output for 5.4.26
test_1: 0.017600059509277 test_2: 0.023030996322632
Output for 5.4.25
test_1: 0.014868974685669 test_2: 0.02134895324707
Output for 5.4.24
test_1: 0.016438007354736 test_2: 0.022146940231323
Output for 5.4.23
test_1: 0.01479697227478 test_2: 0.020381927490234
Output for 5.4.22
test_1: 0.013501882553101 test_2: 0.020672082901001
Output for 5.4.21
test_1: 0.016876935958862 test_2: 0.023506164550781
Output for 5.4.20
test_1: 0.014898061752319 test_2: 0.022972822189331
Output for 5.4.19
test_1: 0.013729810714722 test_2: 0.018906116485596
Output for 5.4.18
test_1: 0.013501167297363 test_2: 0.021497011184692
Output for 5.4.17
test_1: 0.01456093788147 test_2: 0.022777080535889
Output for 5.4.16
test_1: 0.015352010726929 test_2: 0.024538993835449
Output for 5.4.15
test_1: 0.015777111053467 test_2: 0.022734880447388
Output for 5.4.14
test_1: 0.016443014144897 test_2: 0.021160125732422
Output for 5.4.13
test_1: 0.015411853790283 test_2: 0.020195960998535
Output for 5.4.12
test_1: 0.015918970108032 test_2: 0.023779153823853
Output for 5.4.11
test_1: 0.018819093704224 test_2: 0.022412061691284
Output for 5.4.10
test_1: 0.015574216842651 test_2: 0.023900032043457
Output for 5.4.9
test_1: 0.016451835632324 test_2: 0.0260009765625
Output for 5.4.8
test_1: 0.016969919204712 test_2: 0.023816108703613
Output for 5.4.7
test_1: 0.018440961837769 test_2: 0.023126125335693
Output for 5.4.6
test_1: 0.01426887512207 test_2: 0.025293111801147
Output for 5.4.5
test_1: 0.019451856613159 test_2: 0.024706125259399
Output for 5.4.4
test_1: 0.012212038040161 test_2: 0.01880407333374
Output for 5.4.3
test_1: 0.016803979873657 test_2: 0.021697998046875
Output for 5.4.2
test_1: 0.014717102050781 test_2: 0.022163152694702
Output for 5.4.1
test_1: 0.014417886734009 test_2: 0.023096084594727
Output for 5.4.0
test_1: 0.016765832901001 test_2: 0.025895118713379
Output for 5.3.29
test_1: 0.018651008605957 test_2: 0.026611089706421
Output for 5.3.28
test_1: 0.016824007034302 test_2: 0.023317098617554
Output for 5.3.27
test_1: 0.015444040298462 test_2: 0.023540019989014
Output for 5.3.26
test_1: 0.016824007034302 test_2: 0.025546073913574
Output for 5.3.25
test_1: 0.013525009155273 test_2: 0.01875901222229
Output for 5.3.24
test_1: 0.016247034072876 test_2: 0.021509885787964
Output for 5.3.23
test_1: 0.015775203704834 test_2: 0.022285938262939
Output for 5.3.22
test_1: 0.016869068145752 test_2: 0.023561000823975
Output for 5.3.21
test_1: 0.019016027450562 test_2: 0.024965047836304
Output for 5.3.20
test_1: 0.020273923873901 test_2: 0.02627420425415
Output for 5.3.19
test_1: 0.015446901321411 test_2: 0.024915933609009
Output for 5.3.18
test_1: 0.014745950698853 test_2: 0.022696018218994
Output for 5.3.17
test_1: 0.01595401763916 test_2: 0.020190954208374
Output for 5.3.16
test_1: 0.015268802642822 test_2: 0.02276086807251
Output for 5.3.15
test_1: 0.022254943847656 test_2: 0.028307914733887
Output for 5.3.14
test_1: 0.015012979507446 test_2: 0.024538040161133
Output for 5.3.13
test_1: 0.019912958145142 test_2: 0.028695106506348
Output for 5.3.12
test_1: 0.018364191055298 test_2: 0.025068044662476
Output for 5.3.11
test_1: 0.016206979751587 test_2: 0.025516033172607
Output for 5.3.10
test_1: 0.016807079315186 test_2: 0.021507024765015
Output for 5.3.9
test_1: 0.018278121948242 test_2: 0.02027416229248
Output for 5.3.8
test_1: 0.018189907073975 test_2: 0.02375602722168
Output for 5.3.7
test_1: 0.018615007400513 test_2: 0.024533033370972
Output for 5.3.6
test_1: 0.018404960632324 test_2: 0.023534059524536
Output for 5.3.5
test_1: 0.02223801612854 test_2: 0.028302192687988
Output for 5.3.4
test_1: 0.016411781311035 test_2: 0.0224609375
Output for 5.3.3
test_1: 0.016308069229126 test_2: 0.022333860397339
Output for 5.3.2
test_1: 0.022333145141602 test_2: 0.027329921722412
Output for 5.3.1
test_1: 0.01800799369812 test_2: 0.02369213104248
Output for 5.3.0
test_1: 0.020298957824707 test_2: 0.019582033157349
Output for 5.2.17
test_1: 0.024636030197144 test_2: 0.026133060455322
Output for 5.2.16
test_1: 0.02877402305603 test_2: 0.036112070083618
Output for 5.2.15
test_1: 0.024466037750244 test_2: 0.031830072402954
Output for 5.2.14
test_1: 0.024534940719604 test_2: 0.027673006057739
Output for 5.2.13
test_1: 0.020845890045166 test_2: 0.029770851135254
Output for 5.2.12
test_1: 0.021286010742188 test_2: 0.029531955718994
Output for 5.2.11
test_1: 0.023058891296387 test_2: 0.030833005905151
Output for 5.2.10
test_1: 0.021229982376099 test_2: 0.029887914657593
Output for 5.2.9
test_1: 0.02225399017334 test_2: 0.02694296836853
Output for 5.2.8
test_1: 0.020370006561279 test_2: 0.024767160415649
Output for 5.2.7
test_1: 0.025605916976929 test_2: 0.031486988067627
Output for 5.2.6
test_1: 0.01877498626709 test_2: 0.027622938156128
Output for 5.2.5
test_1: 0.02335000038147 test_2: 0.030702114105225
Output for 5.2.4
test_1: 0.028183937072754 test_2: 0.036887884140015
Output for 5.2.3
test_1: 0.023153066635132 test_2: 0.026887893676758
Output for 5.2.2
test_1: 0.020770072937012 test_2: 0.029729843139648
Output for 5.2.1
test_1: 0.024940967559814 test_2: 0.029475927352905
Output for 5.2.0
test_1: 0.025959014892578 test_2: 0.038751125335693
Output for 5.1.6
test_1: 0.027367115020752 test_2: 0.043857097625732
Output for 5.1.5
test_1: 0.030471801757812 test_2: 0.048808097839355
Output for 5.1.4
test_1: 0.031628847122192 test_2: 0.044456005096436
Output for 5.1.3
test_1: 0.023635149002075 test_2: 0.036150217056274
Output for 5.1.2
test_1: 0.031097888946533 test_2: 0.041164875030518
Output for 5.1.1
test_1: 0.022358894348145 test_2: 0.036494970321655
Output for 5.1.0
test_1: 0.032244920730591 test_2: 0.049691915512085
Output for 5.0.5
test_1: 0.060750961303711 test_2: 0.07676100730896
Output for 5.0.4
test_1: 0.069157123565674 test_2: 0.055190086364746
Output for 5.0.3
test_1: 0.059453010559082 test_2: 0.054296970367432
Output for 5.0.2
test_1: 0.066253900527954 test_2: 0.061069965362549
Output for 5.0.1
test_1: 0.064016103744507 test_2: 0.064249992370605
Output for 5.0.0
test_1: 0.058245897293091 test_2: 0.061097860336304
Output for 4.4.9
test_1: 0.069967 test_2: 0.057565
Output for 4.4.8
test_1: 0.065962 test_2: 0.063579
Output for 4.4.7
test_1: 0.066328 test_2: 0.060534
Output for 4.4.6
test_1: 0.045984 test_2: 0.051043
Output for 4.4.5
test_1: 0.060901 test_2: 0.054848
Output for 4.4.4
test_1: 0.055065 test_2: 0.050393
Output for 4.4.3
test_1: 0.080321 test_2: 0.064244
Output for 4.4.2
test_1: 0.074587 test_2: 0.059372
Output for 4.4.1
test_1: 0.07534 test_2: 0.067477
Output for 4.4.0
test_1: 0.069308 test_2: 0.064894
Output for 4.3.11
test_1: 0.063795 test_2: 0.05681
Output for 4.3.10
test_1: 0.074137 test_2: 0.068008
Output for 4.3.9
test_1: 0.07009 test_2: 0.058646
Output for 4.3.8
test_1: 0.069713 test_2: 0.071123
Output for 4.3.7
test_1: 0.077199 test_2: 0.076756
Output for 4.3.6
test_1: 0.071034 test_2: 0.073785
Output for 4.3.5
test_1: 0.059555 test_2: 0.060563
Output for 4.3.4
test_1: 0.060951 test_2: 0.061118
Output for 4.3.3
test_1: 0.066485 test_2: 0.070663
Output for 4.3.2
test_1: 0.071482 test_2: 0.071805
Output for 4.3.1
test_1: 0.053268 test_2: 0.068572
Output for 4.3.0
test_1: 0.052722 test_2: 0.063062