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 = 1000000; echo 'test_1: '.test_1($nb)."\n"; echo 'test_2: '.test_2($nb)."\n";
Output for 7.1.0
test_1: 0.078578948974609 test_2: 0.065243005752563
Output for 7.0.14
test_1: 0.11997389793396 test_2: 0.082799196243286
Output for 7.0.6
test_1: 0.090473175048828 test_2: 0.062169075012207
Output for 7.0.5
test_1: 0.086328029632568 test_2: 0.060519933700562
Output for 7.0.4
test_1: 0.093111038208008 test_2: 0.064267873764038
Output for 7.0.3
test_1: 0.079405069351196 test_2: 0.063513040542603
Output for 7.0.2
test_1: 0.12121605873108 test_2: 0.068306922912598
Output for 7.0.1
test_1: 0.075383186340332 test_2: 0.065685033798218
Output for 7.0.0
test_1: 0.070100069046021 test_2: 0.059895992279053
Output for 5.6.28
test_1: 0.14521980285645 test_2: 0.17484188079834
Output for 5.6.21
test_1: 0.11752605438232 test_2: 0.17366480827332
Output for 5.6.20
test_1: 0.11846518516541 test_2: 0.18542695045471
Output for 5.6.19
test_1: 0.11583209037781 test_2: 0.17533993721008
Output for 5.6.18
test_1: 0.11674094200134 test_2: 0.17489504814148
Output for 5.6.17
test_1: 0.12100195884705 test_2: 0.17399001121521
Output for 5.6.16
test_1: 0.14749383926392 test_2: 0.17825698852539
Output for 5.6.15
test_1: 0.10627102851868 test_2: 0.17508697509766
Output for 5.6.14
test_1: 0.11486220359802 test_2: 0.17444801330566
Output for 5.6.13
test_1: 0.11292481422424 test_2: 0.17407703399658
Output for 5.6.12
test_1: 0.10738396644592 test_2: 0.19620490074158
Output for 5.6.11
test_1: 0.10654997825623 test_2: 0.17484593391418
Output for 5.6.10
test_1: 0.12370681762695 test_2: 0.17878293991089
Output for 5.6.9
test_1: 0.11593389511108 test_2: 0.17747092247009
Output for 5.6.8
test_1: 0.12255311012268 test_2: 0.18424820899963
Output for 5.6.7
test_1: 0.11898589134216 test_2: 0.17986702919006
Output for 5.5.35
test_1: 0.1151180267334 test_2: 0.17715001106262
Output for 5.5.34
test_1: 0.11757206916809 test_2: 0.17255711555481
Output for 5.5.33
test_1: 0.12220907211304 test_2: 0.17971706390381
Output for 5.5.32
test_1: 0.11257791519165 test_2: 0.17504596710205
Output for 5.5.31
test_1: 0.1479640007019 test_2: 0.17827796936035
Output for 5.5.30
test_1: 0.10325908660889 test_2: 0.19313216209412
Output for 5.5.29
test_1: 0.15079188346863 test_2: 0.17815089225769
Output for 5.5.28
test_1: 0.10550999641418 test_2: 0.17614698410034
Output for 5.5.27
test_1: 0.1064190864563 test_2: 0.17723107337952
Output for 5.5.26
test_1: 0.12634205818176 test_2: 0.17588210105896
Output for 5.5.25
test_1: 0.11750197410583 test_2: 0.17609691619873
Output for 5.5.24
test_1: 0.12325310707092 test_2: 0.1756899356842
Output for 5.4.45
test_1: 0.14474606513977 test_2: 0.2214457988739
Output for 5.4.44
test_1: 0.1301441192627 test_2: 0.17085909843445
Output for 5.4.43
test_1: 0.11996293067932 test_2: 0.1867458820343
Output for 5.4.42
test_1: 0.118497133255 test_2: 0.1718909740448
Output for 5.4.41
test_1: 0.12961983680725 test_2: 0.17363500595093
Output for 5.4.40
test_1: 0.12676692008972 test_2: 0.19160103797913
Output for 5.4.39
test_1: 0.10338521003723 test_2: 0.17327904701233
Output for 5.4.38
test_1: 0.12588381767273 test_2: 0.16739511489868
Output for 5.4.37
test_1: 0.12754011154175 test_2: 0.17243790626526
Output for 5.4.36
test_1: 0.10526084899902 test_2: 0.17753410339355
Output for 5.4.35
test_1: 0.12472891807556 test_2: 0.17101693153381
Output for 5.4.34
test_1: 0.1003041267395 test_2: 0.1632981300354
Output for 5.4.32
test_1: 0.10725903511047 test_2: 0.17365193367004
Output for 5.4.31
test_1: 0.11269688606262 test_2: 0.19075417518616
Output for 5.4.30
test_1: 0.10157299041748 test_2: 0.16383910179138
Output for 5.4.29
test_1: 0.11278200149536 test_2: 0.17112421989441
Output for 5.4.28
test_1: 0.12593388557434 test_2: 0.17191195487976
Output for 5.4.27
test_1: 0.13044810295105 test_2: 0.17333102226257
Output for 5.4.26
test_1: 0.12361907958984 test_2: 0.17237997055054
Output for 5.4.25
test_1: 0.13005208969116 test_2: 0.16961789131165
Output for 5.4.24
test_1: 0.12939810752869 test_2: 0.16764688491821
Output for 5.4.23
test_1: 0.11728501319885 test_2: 0.18332099914551
Output for 5.4.22
test_1: 0.14178609848022 test_2: 0.20609593391418
Output for 5.4.21
test_1: 0.13473296165466 test_2: 0.17821097373962
Output for 5.4.20
test_1: 0.12576699256897 test_2: 0.17112398147583
Output for 5.4.19
test_1: 0.13155794143677 test_2: 0.18416213989258
Output for 5.4.18
test_1: 0.13221192359924 test_2: 0.19034385681152
Output for 5.4.17
test_1: 0.12918782234192 test_2: 0.17044687271118
Output for 5.4.16
test_1: 0.12667107582092 test_2: 0.17395901679993
Output for 5.4.15
test_1: 0.13716816902161 test_2: 0.17942404747009
Output for 5.4.14
test_1: 0.10549998283386 test_2: 0.17459511756897
Output for 5.4.13
test_1: 0.10925388336182 test_2: 0.17109298706055
Output for 5.4.12
test_1: 0.12209606170654 test_2: 0.17499685287476
Output for 5.4.11
test_1: 0.13248300552368 test_2: 0.17264795303345
Output for 5.4.10
test_1: 0.12704300880432 test_2: 0.18518900871277
Output for 5.4.9
test_1: 0.1241090297699 test_2: 0.17158102989197
Output for 5.4.8
test_1: 0.11132621765137 test_2: 0.16965198516846
Output for 5.4.7
test_1: 0.12764692306519 test_2: 0.16781497001648
Output for 5.4.6
test_1: 0.12464094161987 test_2: 0.17469382286072
Output for 5.4.5
test_1: 0.11550712585449 test_2: 0.17449498176575
Output for 5.4.4
test_1: 0.11542201042175 test_2: 0.17480301856995
Output for 5.4.3
test_1: 0.13012003898621 test_2: 0.17726898193359
Output for 5.4.2
test_1: 0.13148498535156 test_2: 0.17836093902588
Output for 5.4.1
test_1: 0.13332915306091 test_2: 0.17945599555969
Output for 5.4.0
test_1: 0.13696098327637 test_2: 0.21254420280457
Output for 5.3.29
test_1: 0.11927199363708 test_2: 0.17332410812378
Output for 5.3.28
test_1: 0.15679001808167 test_2: 0.21506500244141
Output for 5.3.27
test_1: 0.1359269618988 test_2: 0.17697405815125
Output for 5.3.26
test_1: 0.13126182556152 test_2: 0.17772102355957
Output for 5.3.25
test_1: 0.13506007194519 test_2: 0.17603492736816
Output for 5.3.24
test_1: 0.11494088172913 test_2: 0.17947697639465
Output for 5.3.23
test_1: 0.11866497993469 test_2: 0.18317413330078
Output for 5.3.22
test_1: 0.11233592033386 test_2: 0.18575310707092
Output for 5.3.21
test_1: 0.15750694274902 test_2: 0.18413996696472
Output for 5.3.20
test_1: 0.14192509651184 test_2: 0.19422507286072
Output for 5.3.19
test_1: 0.13830208778381 test_2: 0.18699789047241
Output for 5.3.18
test_1: 0.13434481620789 test_2: 0.1928870677948
Output for 5.3.17
test_1: 0.14996314048767 test_2: 0.19709491729736
Output for 5.3.16
test_1: 0.13501715660095 test_2: 0.18281888961792
Output for 5.3.15
test_1: 0.14825201034546 test_2: 0.18465304374695
Output for 5.3.14
test_1: 0.11810898780823 test_2: 0.18601298332214
Output for 5.3.13
test_1: 0.13954520225525 test_2: 0.19761419296265
Output for 5.3.12
test_1: 0.13575792312622 test_2: 0.18234610557556
Output for 5.3.11
test_1: 0.13420820236206 test_2: 0.19837188720703
Output for 5.3.10
test_1: 0.11595296859741 test_2: 0.17594909667969
Output for 5.3.9
test_1: 0.13817596435547 test_2: 0.18134117126465
Output for 5.3.8
test_1: 0.14811587333679 test_2: 0.18838000297546
Output for 5.3.7
test_1: 0.15812087059021 test_2: 0.19068598747253
Output for 5.3.6
test_1: 0.14078712463379 test_2: 0.20892882347107
Output for 5.3.5
test_1: 0.15771102905273 test_2: 0.19433188438416
Output for 5.3.4
test_1: 0.17053008079529 test_2: 0.19628286361694
Output for 5.3.3
test_1: 0.13176989555359 test_2: 0.18229103088379
Output for 5.3.2
test_1: 0.14639401435852 test_2: 0.18402504920959
Output for 5.3.1
test_1: 0.15314698219299 test_2: 0.20662593841553
Output for 5.3.0
test_1: 0.15389204025269 test_2: 0.17902302742004
Output for 5.2.17
test_1: 0.19129395484924 test_2: 0.2350800037384
Output for 5.2.16
test_1: 0.1860339641571 test_2: 0.23570394515991
Output for 5.2.15
test_1: 0.19927716255188 test_2: 0.23562598228455
Output for 5.2.14
test_1: 0.17983794212341 test_2: 0.22608304023743
Output for 5.2.13
test_1: 0.18984293937683 test_2: 0.23159599304199
Output for 5.2.12
test_1: 0.19500780105591 test_2: 0.23295211791992
Output for 5.2.11
test_1: 0.19427299499512 test_2: 0.24239301681519
Output for 5.2.10
test_1: 0.18702793121338 test_2: 0.239422082901
Output for 5.2.9
test_1: 0.17811989784241 test_2: 0.22937297821045
Output for 5.2.8
test_1: 0.19361400604248 test_2: 0.2304379940033
Output for 5.2.7
test_1: 0.19283890724182 test_2: 0.2307870388031
Output for 5.2.6
test_1: 0.18683791160583 test_2: 0.23273277282715
Output for 5.2.5
test_1: 0.17232799530029 test_2: 0.22282385826111
Output for 5.2.4
test_1: 0.19503593444824 test_2: 0.23711490631104
Output for 5.2.3
test_1: 0.18244194984436 test_2: 0.23674011230469
Output for 5.2.2
test_1: 0.181312084198 test_2: 0.22315812110901
Output for 5.2.1
test_1: 0.19190001487732 test_2: 0.23187208175659
Output for 5.2.0
test_1: 0.1881959438324 test_2: 0.28995990753174
Output for 5.1.6
test_1: 0.21038389205933 test_2: 0.35066080093384
Output for 5.1.5
test_1: 0.23090481758118 test_2: 0.38518500328064
Output for 5.1.4
test_1: 0.17788290977478 test_2: 0.32893896102905
Output for 5.1.3
test_1: 0.16788005828857 test_2: 0.31398701667786
Output for 5.1.2
test_1: 0.17901301383972 test_2: 0.30580115318298
Output for 5.1.1
test_1: 0.18112301826477 test_2: 0.33901786804199
Output for 5.1.0
test_1: 0.16664695739746 test_2: 0.3073570728302
Output for 5.0.5
test_1: 0.4277880191803 test_2: 0.49767899513245
Output for 5.0.4
test_1: 0.43733406066895 test_2: 0.50398993492126
Output for 5.0.3
test_1: 0.4207010269165 test_2: 0.49632406234741
Output for 5.0.2
test_1: 0.49008417129517 test_2: 0.54129600524902
Output for 5.0.1
test_1: 0.41465592384338 test_2: 0.48813080787659
Output for 5.0.0
test_1: 0.40819597244263 test_2: 0.58807182312012
Output for 4.4.9
test_1: -0.548621 test_2: 0.508391
Output for 4.4.8
test_1: 0.444525 test_2: -0.503951
Output for 4.4.7
test_1: -0.57565 test_2: 0.509458
Output for 4.4.6
test_1: -0.533971 test_2: 0.535541
Output for 4.4.5
test_1: -0.536924 test_2: 0.5022
Output for 4.4.4
test_1: -0.546189 test_2: 0.489043
Output for 4.4.3
test_1: -0.535078 test_2: 0.492785
Output for 4.4.2
test_1: -0.555188 test_2: 0.478526
Output for 4.4.1
test_1: -0.583879 test_2: 0.490242
Output for 4.4.0
test_1: -0.579372 test_2: 0.486743
Output for 4.3.11
test_1: 0.421987 test_2: 0.488206
Output for 4.3.10
test_1: 0.482819 test_2: -0.451345
Output for 4.3.9
test_1: 0.455912 test_2: -0.502719
Output for 4.3.8
test_1: -0.574711 test_2: 0.538716
Output for 4.3.7
test_1: -0.592483 test_2: 0.519823
Output for 4.3.6
test_1: -0.561718 test_2: 0.538413
Output for 4.3.5
test_1: -0.581054 test_2: 0.535277
Output for 4.3.4
test_1: -0.567579 test_2: 0.540607
Output for 4.3.3
test_1: -0.515802 test_2: -0.380942
Output for 4.3.2
test_1: 0.461459 test_2: -0.454394
Output for 4.3.1
test_1: 0.372455 test_2: -0.475748
Output for 4.3.0
test_1: 0.443701 test_2: -0.46127