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).'<br/>'; echo 'test_2: '.test_2($nb).'<br/>';
Output for 7.1.0
test_1: 0.0078170299530029<br/>test_2: 0.006558895111084<br/>
Output for 7.0.14
test_1: 0.014445066452026<br/>test_2: 0.012905120849609<br/>
Output for 7.0.10
test_1: 0.0079050064086914<br/>test_2: 0.0069069862365723<br/>
Output for 7.0.9
test_1: 0.0069260597229004<br/>test_2: 0.0062007904052734<br/>
Output for 7.0.8
test_1: 0.0071620941162109<br/>test_2: 0.0062239170074463<br/>
Output for 7.0.7
test_1: 0.0068869590759277<br/>test_2: 0.0061759948730469<br/>
Output for 7.0.6
test_1: 0.0093379020690918<br/>test_2: 0.0080940723419189<br/>
Output for 7.0.5
test_1: 0.0098838806152344<br/>test_2: 0.0095717906951904<br/>
Output for 7.0.4
test_1: 0.0087990760803223<br/>test_2: 0.006101131439209<br/>
Output for 7.0.3
test_1: 0.011132001876831<br/>test_2: 0.0085818767547607<br/>
Output for 7.0.2
test_1: 0.0076591968536377<br/>test_2: 0.0068879127502441<br/>
Output for 7.0.1
test_1: 0.010926961898804<br/>test_2: 0.0086870193481445<br/>
Output for 7.0.0
test_1: 0.010612964630127<br/>test_2: 0.0089201927185059<br/>
Output for hhvm-3.12.0
test_1: 0.030675172805786<br/>test_2: 0.032896995544434<br/>
Output for hhvm-3.10.0
test_1: 0.040532827377319<br/>test_2: 0.043009042739868<br/>
Output for 5.6.28
test_1: 0.018168926239014<br/>test_2: 0.028929948806763<br/>
Output for 5.6.25
test_1: 0.010880947113037<br/>test_2: 0.018537044525146<br/>
Output for 5.6.24
test_1: 0.015329837799072<br/>test_2: 0.01800799369812<br/>
Output for 5.6.23
test_1: 0.010666131973267<br/>test_2: 0.017995119094849<br/>
Output for 5.6.22
test_1: 0.012156009674072<br/>test_2: 0.018799066543579<br/>
Output for 5.6.21
test_1: 0.0095388889312744<br/>test_2: 0.01448392868042<br/>
Output for 5.6.20
test_1: 0.024665117263794<br/>test_2: 0.036632061004639<br/>
Output for 5.6.19
test_1: 0.015716075897217<br/>test_2: 0.024062156677246<br/>
Output for 5.6.18
test_1: 0.016479969024658<br/>test_2: 0.020626068115234<br/>
Output for 5.6.17
test_1: 0.010619878768921<br/>test_2: 0.018494844436646<br/>
Output for 5.6.16
test_1: 0.014174938201904<br/>test_2: 0.021363973617554<br/>
Output for 5.6.15
test_1: 0.015401124954224<br/>test_2: 0.023741006851196<br/>
Output for 5.6.14
test_1: 0.015480041503906<br/>test_2: 0.023657083511353<br/>
Output for 5.6.13
test_1: 0.016484975814819<br/>test_2: 0.025497198104858<br/>
Output for 5.6.12
test_1: 0.010830879211426<br/>test_2: 0.017913103103638<br/>
Output for 5.6.11
test_1: 0.010784149169922<br/>test_2: 0.017570018768311<br/>
Output for 5.6.10
test_1: 0.015921831130981<br/>test_2: 0.020822048187256<br/>
Output for 5.6.9
test_1: 0.014893054962158<br/>test_2: 0.023228168487549<br/>
Output for 5.6.8
test_1: 0.014417886734009<br/>test_2: 0.021307945251465<br/>
Output for 5.6.7
test_1: 0.014982938766479<br/>test_2: 0.023200988769531<br/>
Output for 5.6.6
test_1: 0.013416051864624<br/>test_2: 0.022046089172363<br/>
Output for 5.6.5
test_1: 0.017874002456665<br/>test_2: 0.028611898422241<br/>
Output for 5.6.4
test_1: 0.011922836303711<br/>test_2: 0.018347024917603<br/>
Output for 5.6.3
test_1: 0.0120689868927<br/>test_2: 0.019363164901733<br/>
Output for 5.6.2
test_1: 0.015721797943115<br/>test_2: 0.026015996932983<br/>
Output for 5.6.1
test_1: 0.015392065048218<br/>test_2: 0.023465871810913<br/>
Output for 5.6.0
test_1: 0.011453151702881<br/>test_2: 0.018653154373169<br/>
Output for 5.5.38
test_1: 0.010491132736206<br/>test_2: 0.017138957977295<br/>
Output for 5.5.37
test_1: 0.010983943939209<br/>test_2: 0.018645048141479<br/>
Output for 5.5.36
test_1: 0.01111912727356<br/>test_2: 0.018771886825562<br/>
Output for 5.5.35
test_1: 0.010010957717896<br/>test_2: 0.016493797302246<br/>
Output for 5.5.34
test_1: 0.016133069992065<br/>test_2: 0.022547960281372<br/>
Output for 5.5.33
test_1: 0.015834093093872<br/>test_2: 0.024848937988281<br/>
Output for 5.5.32
test_1: 0.016847133636475<br/>test_2: 0.026713132858276<br/>
Output for 5.5.31
test_1: 0.022779941558838<br/>test_2: 0.030524969100952<br/>
Output for 5.5.30
test_1: 0.013967037200928<br/>test_2: 0.021823167800903<br/>
Output for 5.5.29
test_1: 0.018534898757935<br/>test_2: 0.023995876312256<br/>
Output for 5.5.28
test_1: 0.011280059814453<br/>test_2: 0.018044948577881<br/>
Output for 5.5.27
test_1: 0.010499954223633<br/>test_2: 0.017752170562744<br/>
Output for 5.5.26
test_1: 0.015671968460083<br/>test_2: 0.023094892501831<br/>
Output for 5.5.25
test_1: 0.016479969024658<br/>test_2: 0.025458812713623<br/>
Output for 5.5.24
test_1: 0.015717029571533<br/>test_2: 0.024669170379639<br/>
Output for 5.5.23
test_1: 0.021638870239258<br/>test_2: 0.030158996582031<br/>
Output for 5.5.22
test_1: 0.017084121704102<br/>test_2: 0.026273012161255<br/>
Output for 5.5.21
test_1: 0.015491962432861<br/>test_2: 0.024055004119873<br/>
Output for 5.5.20
test_1: 0.014730930328369<br/>test_2: 0.020254135131836<br/>
Output for 5.5.19
test_1: 0.015848875045776<br/>test_2: 0.019791126251221<br/>
Output for 5.5.18
test_1: 0.016669988632202<br/>test_2: 0.023332834243774<br/>
Output for 5.5.16
test_1: 0.011104106903076<br/>test_2: 0.017848014831543<br/>
Output for 5.5.15
test_1: 0.01577091217041<br/>test_2: 0.021834850311279<br/>
Output for 5.5.14
test_1: 0.014349937438965<br/>test_2: 0.022418022155762<br/>
Output for 5.5.13
test_1: 0.012891054153442<br/>test_2: 0.020781993865967<br/>
Output for 5.5.12
test_1: 0.013158082962036<br/>test_2: 0.0208899974823<br/>
Output for 5.5.11
test_1: 0.017960071563721<br/>test_2: 0.026964902877808<br/>
Output for 5.5.10
test_1: 0.015588045120239<br/>test_2: 0.024389982223511<br/>
Output for 5.5.9
test_1: 0.016151905059814<br/>test_2: 0.023772954940796<br/>
Output for 5.5.8
test_1: 0.013953924179077<br/>test_2: 0.018867969512939<br/>
Output for 5.5.7
test_1: 0.013272047042847<br/>test_2: 0.022176027297974<br/>
Output for 5.5.6
test_1: 0.012874126434326<br/>test_2: 0.022397994995117<br/>
Output for 5.5.5
test_1: 0.011963844299316<br/>test_2: 0.019650936126709<br/>
Output for 5.5.4
test_1: 0.013782978057861<br/>test_2: 0.020845890045166<br/>
Output for 5.5.3
test_1: 0.015701055526733<br/>test_2: 0.024906158447266<br/>
Output for 5.5.2
test_1: 0.013419151306152<br/>test_2: 0.017781972885132<br/>
Output for 5.5.1
test_1: 0.017101049423218<br/>test_2: 0.028684854507446<br/>
Output for 5.5.0
test_1: 0.014328956604004<br/>test_2: 0.021381139755249<br/>
Output for 5.4.45
test_1: 0.01056694984436<br/>test_2: 0.018297910690308<br/>
Output for 5.4.44
test_1: 0.010869026184082<br/>test_2: 0.017374038696289<br/>
Output for 5.4.43
test_1: 0.010714769363403<br/>test_2: 0.017897844314575<br/>
Output for 5.4.42
test_1: 0.013697862625122<br/>test_2: 0.021039009094238<br/>
Output for 5.4.41
test_1: 0.017104864120483<br/>test_2: 0.026351928710938<br/>
Output for 5.4.40
test_1: 0.01678204536438<br/>test_2: 0.025827884674072<br/>
Output for 5.4.39
test_1: 0.015290021896362<br/>test_2: 0.024532079696655<br/>
Output for 5.4.38
test_1: 0.015852928161621<br/>test_2: 0.025300025939941<br/>
Output for 5.4.37
test_1: 0.018258094787598<br/>test_2: 0.025608062744141<br/>
Output for 5.4.36
test_1: 0.016797065734863<br/>test_2: 0.025396108627319<br/>
Output for 5.4.35
test_1: 0.0097370147705078<br/>test_2: 0.016278028488159<br/>
Output for 5.4.34
test_1: 0.01360011100769<br/>test_2: 0.020029067993164<br/>
Output for 5.4.32
test_1: 0.016282081604004<br/>test_2: 0.0260009765625<br/>
Output for 5.4.31
test_1: 0.015006065368652<br/>test_2: 0.023985147476196<br/>
Output for 5.4.30
test_1: 0.015961885452271<br/>test_2: 0.024492025375366<br/>
Output for 5.4.29
test_1: 0.015505075454712<br/>test_2: 0.023504018783569<br/>
Output for 5.4.28
test_1: 0.017203092575073<br/>test_2: 0.024486064910889<br/>
Output for 5.4.27
test_1: 0.01347804069519<br/>test_2: 0.021553039550781<br/>
Output for 5.4.26
test_1: 0.016911029815674<br/>test_2: 0.02595591545105<br/>
Output for 5.4.25
test_1: 0.015926837921143<br/>test_2: 0.022941112518311<br/>
Output for 5.4.24
test_1: 0.010377168655396<br/>test_2: 0.018347978591919<br/>
Output for 5.4.23
test_1: 0.02406907081604<br/>test_2: 0.033148050308228<br/>
Output for 5.4.22
test_1: 0.019275188446045<br/>test_2: 0.027469873428345<br/>
Output for 5.4.21
test_1: 0.013206005096436<br/>test_2: 0.020172119140625<br/>
Output for 5.4.20
test_1: 0.01171088218689<br/>test_2: 0.01899790763855<br/>
Output for 5.4.19
test_1: 0.01784610748291<br/>test_2: 0.026380062103271<br/>
Output for 5.4.18
test_1: 0.020488977432251<br/>test_2: 0.030281066894531<br/>
Output for 5.4.17
test_1: 0.016139984130859<br/>test_2: 0.025951862335205<br/>
Output for 5.4.16
test_1: 0.013216018676758<br/>test_2: 0.02112603187561<br/>
Output for 5.4.15
test_1: 0.014100074768066<br/>test_2: 0.021344900131226<br/>
Output for 5.4.14
test_1: 0.01601505279541<br/>test_2: 0.02466082572937<br/>
Output for 5.4.13
test_1: 0.010393142700195<br/>test_2: 0.017369985580444<br/>
Output for 5.4.12
test_1: 0.017982959747314<br/>test_2: 0.02686595916748<br/>
Output for 5.4.11
test_1: 0.010335922241211<br/>test_2: 0.023096084594727<br/>
Output for 5.4.10
test_1: 0.012392997741699<br/>test_2: 0.01808500289917<br/>
Output for 5.4.9
test_1: 0.012471914291382<br/>test_2: 0.019942998886108<br/>
Output for 5.4.8
test_1: 0.015403985977173<br/>test_2: 0.023545980453491<br/>
Output for 5.4.7
test_1: 0.012773990631104<br/>test_2: 0.019797086715698<br/>
Output for 5.4.6
test_1: 0.016503095626831<br/>test_2: 0.022778987884521<br/>
Output for 5.4.5
test_1: 0.015442848205566<br/>test_2: 0.024724006652832<br/>
Output for 5.4.4
test_1: 0.014918804168701<br/>test_2: 0.023936986923218<br/>
Output for 5.4.3
test_1: 0.015522956848145<br/>test_2: 0.023380041122437<br/>
Output for 5.4.2
test_1: 0.017269134521484<br/>test_2: 0.027915954589844<br/>
Output for 5.4.1
test_1: 0.015915870666504<br/>test_2: 0.024433851242065<br/>
Output for 5.4.0
test_1: 0.014369964599609<br/>test_2: 0.024088144302368<br/>
Output for 5.3.29
test_1: 0.015265941619873<br/>test_2: 0.024111986160278<br/>
Output for 5.3.28
test_1: 0.011455059051514<br/>test_2: 0.018202066421509<br/>
Output for 5.3.27
test_1: 0.016487836837769<br/>test_2: 0.024626016616821<br/>
Output for 5.3.26
test_1: 0.012894153594971<br/>test_2: 0.018500804901123<br/>
Output for 5.3.25
test_1: 0.015528202056885<br/>test_2: 0.020519971847534<br/>
Output for 5.3.24
test_1: 0.017058849334717<br/>test_2: 0.025960922241211<br/>
Output for 5.3.23
test_1: 0.018754959106445<br/>test_2: 0.024199962615967<br/>
Output for 5.3.22
test_1: 0.019191980361938<br/>test_2: 0.022103071212769<br/>
Output for 5.3.21
test_1: 0.01289701461792<br/>test_2: 0.018978834152222<br/>
Output for 5.3.20
test_1: 0.011964082717896<br/>test_2: 0.01687216758728<br/>
Output for 5.3.19
test_1: 0.016296863555908<br/>test_2: 0.024043083190918<br/>
Output for 5.3.18
test_1: 0.015738010406494<br/>test_2: 0.023583173751831<br/>
Output for 5.3.17
test_1: 0.015397071838379<br/>test_2: 0.023459911346436<br/>
Output for 5.3.16
test_1: 0.018646955490112<br/>test_2: 0.028028011322021<br/>
Output for 5.3.15
test_1: 0.022059917449951<br/>test_2: 0.028504848480225<br/>
Output for 5.3.14
test_1: 0.016149044036865<br/>test_2: 0.022590160369873<br/>
Output for 5.3.13
test_1: 0.013938903808594<br/>test_2: 0.021005868911743<br/>
Output for 5.3.12
test_1: 0.017498016357422<br/>test_2: 0.028196096420288<br/>
Output for 5.3.11
test_1: 0.013806819915771<br/>test_2: 0.01823902130127<br/>
Output for 5.3.10
test_1: 0.017390012741089<br/>test_2: 0.025055885314941<br/>
Output for 5.3.9
test_1: 0.016310214996338<br/>test_2: 0.018921136856079<br/>
Output for 5.3.8
test_1: 0.015552997589111<br/>test_2: 0.022518873214722<br/>
Output for 5.3.7
test_1: 0.013496875762939<br/>test_2: 0.019617080688477<br/>
Output for 5.3.6
test_1: 0.016937971115112<br/>test_2: 0.021537065505981<br/>
Output for 5.3.5
test_1: 0.020196199417114<br/>test_2: 0.025464057922363<br/>
Output for 5.3.4
test_1: 0.021229028701782<br/>test_2: 0.0278160572052<br/>
Output for 5.3.3
test_1: 0.018667936325073<br/>test_2: 0.0190589427948<br/>
Output for 5.3.2
test_1: 0.018718004226685<br/>test_2: 0.024209976196289<br/>
Output for 5.3.1
test_1: 0.020565986633301<br/>test_2: 0.022234916687012<br/>
Output for 5.3.0
test_1: 0.020089149475098<br/>test_2: 0.026018142700195<br/>
Output for 5.2.17
test_1: 0.026937007904053<br/>test_2: 0.034875154495239<br/>
Output for 5.2.16
test_1: 0.019266843795776<br/>test_2: 0.025691032409668<br/>
Output for 5.2.15
test_1: 0.030662059783936<br/>test_2: 0.037446975708008<br/>
Output for 5.2.14
test_1: 0.027714967727661<br/>test_2: 0.034178972244263<br/>
Output for 5.2.13
test_1: 0.020048856735229<br/>test_2: 0.027422904968262<br/>
Output for 5.2.12
test_1: 0.025189161300659<br/>test_2: 0.028179883956909<br/>
Output for 5.2.11
test_1: 0.019355058670044<br/>test_2: 0.023072957992554<br/>
Output for 5.2.10
test_1: 0.020315170288086<br/>test_2: 0.028205871582031<br/>
Output for 5.2.9
test_1: 0.027307033538818<br/>test_2: 0.034979104995728<br/>
Output for 5.2.8
test_1: 0.023598194122314<br/>test_2: 0.030986070632935<br/>
Output for 5.2.7
test_1: 0.026189088821411<br/>test_2: 0.027940988540649<br/>
Output for 5.2.6
test_1: 0.02813196182251<br/>test_2: 0.035684108734131<br/>
Output for 5.2.5
test_1: 0.025855779647827<br/>test_2: 0.031994104385376<br/>
Output for 5.2.4
test_1: 0.025151968002319<br/>test_2: 0.031266927719116<br/>
Output for 5.2.3
test_1: 0.025341987609863<br/>test_2: 0.033354043960571<br/>
Output for 5.2.2
test_1: 0.037237882614136<br/>test_2: 0.03538703918457<br/>
Output for 5.2.1
test_1: 0.016308069229126<br/>test_2: 0.022190093994141<br/>
Output for 5.2.0
test_1: 0.024922132492065<br/>test_2: 0.065319061279297<br/>
Output for 5.1.6
test_1: 0.028795003890991<br/>test_2: 0.043812990188599<br/>
Output for 5.1.5
test_1: 0.031646966934204<br/>test_2: 0.051037073135376<br/>
Output for 5.1.4
test_1: 0.020567893981934<br/>test_2: 0.034260034561157<br/>
Output for 5.1.3
test_1: 0.021368980407715<br/>test_2: 0.036647796630859<br/>
Output for 5.1.2
test_1: 0.030672073364258<br/>test_2: 0.038886070251465<br/>
Output for 5.1.1
test_1: 0.024828910827637<br/>test_2: 0.039988994598389<br/>
Output for 5.1.0
test_1: 0.029217004776001<br/>test_2: 0.048687934875488<br/>
Output for 5.0.5
test_1: 0.056044101715088<br/>test_2: 0.057373046875<br/>
Output for 5.0.4
test_1: 0.04502010345459<br/>test_2: 0.062057018280029<br/>
Output for 5.0.3
test_1: 0.067931890487671<br/>test_2: 0.06134295463562<br/>
Output for 5.0.2
test_1: 0.066565036773682<br/>test_2: 0.064128160476685<br/>
Output for 5.0.1
test_1: 0.050223827362061<br/>test_2: 0.054777860641479<br/>
Output for 5.0.0
test_1: 0.061525821685791<br/>test_2: 0.066450119018555<br/>
Output for 4.4.9
test_1: 0.070823<br/>test_2: 0.063007<br/>
Output for 4.4.8
test_1: 0.054418<br/>test_2: 0.057636<br/>
Output for 4.4.7
test_1: 0.077262<br/>test_2: 0.067393<br/>
Output for 4.4.6
test_1: 0.073736<br/>test_2: 0.069974<br/>
Output for 4.4.5
test_1: 0.065638<br/>test_2: 0.065331<br/>
Output for 4.4.4
test_1: 0.049516<br/>test_2: 0.050682<br/>
Output for 4.4.3
test_1: 0.065484<br/>test_2: 0.056076<br/>
Output for 4.4.2
test_1: 0.072992<br/>test_2: 0.061717<br/>
Output for 4.4.1
test_1: 0.053611<br/>test_2: 0.062611<br/>
Output for 4.4.0
test_1: 0.058362<br/>test_2: 0.05243<br/>
Output for 4.3.11
test_1: 0.068608<br/>test_2: 0.060649<br/>
Output for 4.3.10
test_1: 0.064528<br/>test_2: 0.053195<br/>
Output for 4.3.9
test_1: 0.058295<br/>test_2: 0.053888<br/>
Output for 4.3.8
test_1: 0.073031<br/>test_2: 0.068431<br/>
Output for 4.3.7
test_1: 0.070918<br/>test_2: 0.0661<br/>
Output for 4.3.6
test_1: 0.070726<br/>test_2: 0.071497<br/>
Output for 4.3.5
test_1: 0.072114<br/>test_2: 0.070863<br/>
Output for 4.3.4
test_1: 0.062198<br/>test_2: 0.056966<br/>
Output for 4.3.3
test_1: 0.067836<br/>test_2: 0.073306<br/>
Output for 4.3.2
test_1: 0.063087<br/>test_2: 0.057662<br/>
Output for 4.3.1
test_1: 0.069328<br/>test_2: 0.073813<br/>
Output for 4.3.0
test_1: 0.07174<br/>test_2: 0.076918<br/>