3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test1() { $str = 'derp'; if ($str != 'files' && $str != 'something' && $str != 'Derrr') { return; } return; } function test2() { $str = 'derp'; switch ($str) { case 'files': case 'something': case 'Derrr': break; default: return; } return; } $start1 = microtime(1); for ($i = 1; $i < 10000; $i++) { test1(); } $start1 -= microtime(1); echo "test1: $start1"; $start2 = microtime(1); for ($i = 1; $i < 10000; $i++) { test2(); } $start2 -= microtime(1); echo "\ntest2: $start2\n\n"; if ($start1 < $start2) { $perc = round(($start1 / $start2) * 100,2)-100; echo "Test1 is $perc faster than Test2"; } if ($start2 < $start2) { $perc = round(($start2 / $start1) * 100,2)-100; echo "Test2 is $perc faster than Test1"; }
Output for 7.1.0
test1: -0.00079798698425293 test2: -0.00060105323791504 Test1 is 32.76 faster than Test2
Output for 7.0.14
test1: -0.0013039112091064 test2: -0.00089693069458008 Test1 is 45.37 faster than Test2
Output for 7.0.7
test1: -0.0004730224609375 test2: -0.00036811828613281 Test1 is 28.5 faster than Test2
Output for 7.0.6
test1: -0.00040411949157715 test2: -0.00031304359436035 Test1 is 29.09 faster than Test2
Output for 7.0.5
test1: -0.00040102005004883 test2: -0.00030899047851562 Test1 is 29.78 faster than Test2
Output for 7.0.4
test1: -0.00065207481384277 test2: -0.0003659725189209 Test1 is 78.18 faster than Test2
Output for 7.0.3
test1: -0.0003969669342041 test2: -0.00030803680419922 Test1 is 28.87 faster than Test2
Output for 7.0.2
test1: -0.00042200088500977 test2: -0.0003361701965332 Test1 is 25.53 faster than Test2
Output for 7.0.1
test1: -0.00040698051452637 test2: -0.00030708312988281 Test1 is 32.53 faster than Test2
Output for 7.0.0
test1: -0.00040006637573242 test2: -0.00036406517028809 Test1 is 9.89 faster than Test2
Output for hhvm-3.12.0
test1: -0.00154709815979 test2: -0.0016031265258789
Output for hhvm-3.10.0
test1: -0.0020709037780762 test2: -0.0018408298492432 Test1 is 12.5 faster than Test2
Output for 5.6.28
test1: 0.003464937210083 test2: 0.0031960010528564
Output for 5.6.22
test1: -0.00177001953125 test2: -0.002208948135376
Output for 5.6.21
test1: -0.0017158985137939 test2: -0.0020289421081543
Output for 5.6.20
test1: -0.001539945602417 test2: -0.0018939971923828
Output for 5.6.19
test1: -0.0014848709106445 test2: -0.0017790794372559
Output for 5.6.18
test1: -0.0015039443969727 test2: -0.0017848014831543
Output for 5.6.17
test1: -0.0026171207427979 test2: -0.0017778873443604 Test1 is 47.2 faster than Test2
Output for 5.6.16
test1: -0.0030250549316406 test2: -0.0031459331512451
Output for 5.6.15
test1: -0.0016000270843506 test2: -0.0019071102142334
Output for 5.6.14
test1: -0.0015280246734619 test2: -0.0018129348754883
Output for 5.6.13
test1: -0.0028409957885742 test2: -0.0020148754119873 Test1 is 41 faster than Test2
Output for 5.6.12
test1: -0.0014669895172119 test2: -0.0017869472503662
Output for 5.6.11
test1: -0.0014891624450684 test2: -0.0017940998077393
Output for 5.6.10
test1: -0.0014870166778564 test2: -0.0018110275268555
Output for 5.6.9
test1: -0.0025651454925537 test2: -0.0027749538421631
Output for 5.6.8
test1: -0.0015418529510498 test2: -0.0020880699157715
Output for 5.6.7
test1: -0.0021498203277588 test2: -0.0025291442871094
Output for 5.6.6
test1: -0.002418041229248 test2: -0.0029690265655518
Output for 5.6.5
test1: -0.0017759799957275 test2: -0.0021688938140869
Output for 5.6.4
test1: -0.0019328594207764 test2: -0.0023250579833984
Output for 5.6.3
test1: -0.0028719902038574 test2: -0.0034480094909668
Output for 5.6.2
test1: -0.0018908977508545 test2: -0.0022671222686768
Output for 5.6.1
test1: -0.0018079280853271 test2: -0.0022029876708984
Output for 5.6.0
test1: -0.002277135848999 test2: -0.0029139518737793
Output for 5.5.36
test1: -0.0018529891967773 test2: -0.002284049987793
Output for 5.5.35
test1: -0.0014939308166504 test2: -0.001845121383667
Output for 5.5.34
test1: -0.0019490718841553 test2: -0.0020411014556885
Output for 5.5.33
test1: -0.0014801025390625 test2: -0.0018069744110107
Output for 5.5.32
test1: -0.0016489028930664 test2: -0.0019369125366211
Output for 5.5.31
test1: -0.0026049613952637 test2: -0.0027251243591309
Output for 5.5.30
test1: -0.0014548301696777 test2: -0.0017540454864502
Output for 5.5.29
test1: -0.0014998912811279 test2: -0.0018179416656494
Output for 5.5.28
test1: -0.0014739036560059 test2: -0.0017609596252441
Output for 5.5.27
test1: -0.0014870166778564 test2: -0.0018050670623779
Output for 5.5.26
test1: -0.0014979839324951 test2: -0.0018229484558105
Output for 5.5.25
test1: -0.0014979839324951 test2: -0.0018041133880615
Output for 5.5.24
test1: -0.0021049976348877 test2: -0.0024628639221191
Output for 5.5.23
test1: -0.0016000270843506 test2: -0.0018720626831055
Output for 5.5.22
test1: -0.0022399425506592 test2: -0.0026500225067139
Output for 5.5.21
test1: -0.0026628971099854 test2: -0.0031559467315674
Output for 5.5.20
test1: -0.00187087059021 test2: -0.0021810531616211
Output for 5.5.19
test1: -0.001816987991333 test2: -0.0021419525146484
Output for 5.5.18
test1: -0.0026838779449463 test2: -0.0033700466156006
Output for 5.5.16
test1: -0.0028839111328125 test2: -0.003352165222168
Output for 5.5.15
test1: -0.0017449855804443 test2: -0.0021400451660156
Output for 5.5.14
test1: -0.0015721321105957 test2: -0.0018210411071777
Output for 5.5.13
test1: -0.0018148422241211 test2: -0.0021541118621826
Output for 5.5.12
test1: -0.004932165145874 test2: -0.0034010410308838 Test1 is 45.02 faster than Test2
Output for 5.5.11
test1: -0.0036211013793945 test2: -0.0031070709228516 Test1 is 16.54 faster than Test2
Output for 5.5.10
test1: -0.0017731189727783 test2: -0.0021660327911377
Output for 5.5.9
test1: -0.0052769184112549 test2: -0.0050079822540283 Test1 is 5.37 faster than Test2
Output for 5.5.8
test1: -0.0029780864715576 test2: -0.0034620761871338
Output for 5.5.7
test1: -0.0017421245574951 test2: -0.0022108554840088
Output for 5.5.6
test1: -0.0017490386962891 test2: -0.0022130012512207
Output for 5.5.5
test1: -0.0034279823303223 test2: -0.0044000148773193
Output for 5.5.4
test1: -0.0027201175689697 test2: -0.0031390190124512
Output for 5.5.3
test1: -0.0017769336700439 test2: -0.0023119449615479
Output for 5.5.2
test1: -0.0024240016937256 test2: -0.0030920505523682
Output for 5.5.1
test1: -0.0017931461334229 test2: -0.0022621154785156
Output for 5.5.0
test1: -0.0017011165618896 test2: -0.002187967300415
Output for 5.4.45
test1: -0.0014119148254395 test2: -0.0017499923706055
Output for 5.4.44
test1: -0.0015010833740234 test2: -0.0019698143005371
Output for 5.4.43
test1: -0.0014169216156006 test2: -0.0017299652099609
Output for 5.4.42
test1: -0.0014121532440186 test2: -0.0017509460449219
Output for 5.4.41
test1: -0.0025300979614258 test2: -0.0022881031036377 Test1 is 10.58 faster than Test2
Output for 5.4.40
test1: -0.0016360282897949 test2: -0.0019218921661377
Output for 5.4.39
test1: -0.0014119148254395 test2: -0.001816987991333
Output for 5.4.38
test1: -0.0014581680297852 test2: -0.0018081665039062
Output for 5.4.37
test1: -0.0018930435180664 test2: -0.0023281574249268
Output for 5.4.36
test1: -0.0020210742950439 test2: -0.0024871826171875
Output for 5.4.35
test1: -0.0034151077270508 test2: -0.0036170482635498
Output for 5.4.34
test1: -0.0017299652099609 test2: -0.0021350383758545
Output for 5.4.32
test1: -0.002202033996582 test2: -0.0029189586639404
Output for 5.4.31
test1: -0.0022141933441162 test2: -0.0025839805603027
Output for 5.4.30
test1: -0.0020380020141602 test2: -0.0024988651275635
Output for 5.4.29
test1: -0.0020699501037598 test2: -0.0024960041046143
Output for 5.4.28
test1: -0.0018689632415771 test2: -0.0023360252380371
Output for 5.4.27
test1: -0.0021319389343262 test2: -0.0026049613952637
Output for 5.4.26
test1: -0.0028810501098633 test2: -0.003558874130249
Output for 5.4.25
test1: -0.0019519329071045 test2: -0.0024139881134033
Output for 5.4.24
test1: -0.0027101039886475 test2: -0.0035400390625
Output for 5.4.23
test1: -0.0018990039825439 test2: -0.0022449493408203
Output for 5.4.22
test1: -0.0028340816497803 test2: -0.0033860206604004
Output for 5.4.21
test1: -0.0028560161590576 test2: -0.0034949779510498
Output for 5.4.20
test1: -0.0023210048675537 test2: -0.002971887588501
Output for 5.4.19
test1: -0.0020139217376709 test2: -0.0022978782653809
Output for 5.4.18
test1: -0.002716064453125 test2: -0.0031840801239014
Output for 5.4.17
test1: -0.0028979778289795 test2: -0.0033321380615234
Output for 5.4.16
test1: -0.0019950866699219 test2: -0.002540111541748
Output for 5.4.15
test1: -0.0024428367614746 test2: -0.0030169486999512
Output for 5.4.14
test1: -0.0023109912872314 test2: -0.0027999877929688
Output for 5.4.13
test1: -0.0016839504241943 test2: -0.0022058486938477
Output for 5.4.12
test1: -0.0030710697174072 test2: -0.0038399696350098
Output for 5.4.11
test1: -0.0019948482513428 test2: -0.002662181854248
Output for 5.4.10
test1: -0.0028579235076904 test2: -0.0036330223083496
Output for 5.4.9
test1: -0.0021810531616211 test2: -0.0030660629272461
Output for 5.4.8
test1: -0.0027601718902588 test2: -0.0035409927368164
Output for 5.4.7
test1: -0.0024280548095703 test2: -0.0031230449676514
Output for 5.4.6
test1: -0.00205397605896 test2: -0.0025589466094971
Output for 5.4.5
test1: -0.0021300315856934 test2: -0.0026631355285645
Output for 5.4.4
test1: -0.0027780532836914 test2: -0.0029580593109131
Output for 5.4.3
test1: -0.0021460056304932 test2: -0.0027120113372803
Output for 5.4.2
test1: -0.0018320083618164 test2: -0.0022079944610596
Output for 5.4.1
test1: -0.0028228759765625 test2: -0.003654956817627
Output for 5.4.0
test1: -0.003087043762207 test2: -0.0030221939086914 Test1 is 2.15 faster than Test2
Output for 5.3.29
test1: -0.0027661323547363 test2: -0.0026211738586426 Test1 is 5.53 faster than Test2
Output for 5.3.28
test1: -0.0040500164031982 test2: -0.0037720203399658 Test1 is 7.37 faster than Test2
Output for 5.3.27
test1: -0.0029299259185791 test2: -0.0027711391448975 Test1 is 5.73 faster than Test2
Output for 5.3.26
test1: -0.0025479793548584 test2: -0.0024490356445312 Test1 is 4.04 faster than Test2
Output for 5.3.25
test1: -0.0025379657745361 test2: -0.0024080276489258 Test1 is 5.4 faster than Test2
Output for 5.3.24
test1: -0.0027539730072021 test2: -0.002575159072876 Test1 is 6.94 faster than Test2
Output for 5.3.23
test1: -0.0043289661407471 test2: -0.0039820671081543 Test1 is 8.71 faster than Test2
Output for 5.3.22
test1: -0.0040080547332764 test2: -0.0039699077606201 Test1 is 0.95999999999999 faster than Test2
Output for 5.3.21
test1: -0.0043821334838867 test2: -0.0039141178131104 Test1 is 11.96 faster than Test2
Output for 5.3.20
test1: -0.0025830268859863 test2: -0.0025279521942139 Test1 is 2.18 faster than Test2
Output for 5.3.19
test1: -0.0045788288116455 test2: -0.0042800903320312 Test1 is 6.98 faster than Test2
Output for 5.3.18
test1: -0.002100944519043 test2: -0.0020580291748047 Test1 is 2.09 faster than Test2
Output for 5.3.17
test1: -0.0025639533996582 test2: -0.0025348663330078 Test1 is 1.15 faster than Test2
Output for 5.3.16
test1: -0.0033040046691895 test2: -0.0032241344451904 Test1 is 2.48 faster than Test2
Output for 5.3.15
test1: -0.0042660236358643 test2: -0.0038671493530273 Test1 is 10.31 faster than Test2
Output for 5.3.14
test1: -0.0050461292266846 test2: -0.0038778781890869 Test1 is 30.13 faster than Test2
Output for 5.3.13
test1: -0.0026040077209473 test2: -0.0024509429931641 Test1 is 6.25 faster than Test2
Output for 5.3.12
test1: -0.0040779113769531 test2: -0.0037081241607666 Test1 is 9.97 faster than Test2
Output for 5.3.11
test1: -0.0045208930969238 test2: -0.0042300224304199 Test1 is 6.88 faster than Test2
Output for 5.3.10
test1: -0.0038268566131592 test2: -0.003648042678833 Test1 is 4.9 faster than Test2
Output for 5.3.9
test1: -0.0031421184539795 test2: -0.0024330615997314 Test1 is 29.14 faster than Test2
Output for 5.3.8
test1: -0.0033299922943115 test2: -0.0030829906463623 Test1 is 8.01 faster than Test2
Output for 5.3.7
test1: -0.0027639865875244 test2: -0.002593994140625 Test1 is 6.55 faster than Test2
Output for 5.3.6
test1: -0.0039570331573486 test2: -0.0036702156066895 Test1 is 7.81 faster than Test2
Output for 5.3.5
test1: -0.0042579174041748 test2: -0.0039551258087158 Test1 is 7.66 faster than Test2
Output for 5.3.4
test1: -0.0025370121002197 test2: -0.0036840438842773
Output for 5.3.3
test1: -0.0026578903198242 test2: -0.0024349689483643 Test1 is 9.15 faster than Test2
Output for 5.3.2
test1: -0.0039539337158203 test2: -0.00360107421875 Test1 is 9.8 faster than Test2
Output for 5.3.1
test1: -0.0027210712432861 test2: -0.0026600360870361 Test1 is 2.29 faster than Test2
Output for 5.3.0
test1: -0.0033440589904785 test2: -0.0033128261566162 Test1 is 0.94 faster than Test2
Output for 5.2.17
test1: -0.0055339336395264 test2: -0.0050079822540283 Test1 is 10.5 faster than Test2
Output for 5.2.16
test1: -0.0041499137878418 test2: -0.0038518905639648 Test1 is 7.74 faster than Test2
Output for 5.2.15
test1: -0.0042099952697754 test2: -0.0039949417114258 Test1 is 5.38 faster than Test2
Output for 5.2.14
test1: -0.004863977432251 test2: -0.0044980049133301 Test1 is 8.14 faster than Test2
Output for 5.2.13
test1: -0.0040650367736816 test2: -0.0037288665771484 Test1 is 9.02 faster than Test2
Output for 5.2.12
test1: -0.004335880279541 test2: -0.003943920135498 Test1 is 9.94 faster than Test2
Output for 5.2.11
test1: -0.0069599151611328 test2: -0.0062270164489746 Test1 is 11.77 faster than Test2
Output for 5.2.10
test1: -0.0051310062408447 test2: -0.0048539638519287 Test1 is 5.71 faster than Test2
Output for 5.2.9
test1: -0.0048060417175293 test2: -0.0044980049133301 Test1 is 6.85 faster than Test2
Output for 5.2.8
test1: -0.0051219463348389 test2: -0.0048828125 Test1 is 4.9 faster than Test2
Output for 5.2.7
test1: -0.0046720504760742 test2: -0.0041470527648926 Test1 is 12.66 faster than Test2
Output for 5.2.6
test1: -0.0040650367736816 test2: -0.003849983215332 Test1 is 5.59 faster than Test2
Output for 5.2.5
test1: -0.0040850639343262 test2: -0.0037767887115479 Test1 is 8.16 faster than Test2
Output for 5.2.4
test1: -0.0081369876861572 test2: -0.0071070194244385 Test1 is 14.49 faster than Test2
Output for 5.2.3
test1: -0.0043191909790039 test2: -0.0038619041442871 Test1 is 11.84 faster than Test2
Output for 5.2.2
test1: -0.0045130252838135 test2: -0.0041630268096924 Test1 is 8.41 faster than Test2
Output for 5.2.1
test1: -0.0043849945068359 test2: -0.0039551258087158 Test1 is 10.87 faster than Test2
Output for 5.2.0
test1: -0.0046541690826416 test2: -0.0042901039123535 Test1 is 8.49 faster than Test2
Output for 5.1.6
test1: -0.0065791606903076 test2: -0.0075678825378418
Output for 5.1.5
test1: -0.0062630176544189 test2: -0.0058071613311768 Test1 is 7.85 faster than Test2
Output for 5.1.4
test1: -0.0070700645446777 test2: -0.0063109397888184 Test1 is 12.03 faster than Test2
Output for 5.1.3
test1: -0.0074019432067871 test2: -0.0065011978149414 Test1 is 13.86 faster than Test2
Output for 5.1.2
test1: -0.0055198669433594 test2: -0.0049347877502441 Test1 is 11.86 faster than Test2
Output for 5.1.1
test1: -0.0061218738555908 test2: -0.0055930614471436 Test1 is 9.45 faster than Test2
Output for 5.1.0
test1: -0.0071179866790771 test2: -0.0059449672698975 Test1 is 19.73 faster than Test2
Output for 5.0.5
test1: -0.0070538520812988 test2: -0.006213903427124 Test1 is 13.52 faster than Test2
Output for 5.0.4
test1: -0.0094029903411865 test2: -0.0087008476257324 Test1 is 8.07 faster than Test2
Output for 5.0.3
test1: -0.0097839832305908 test2: -0.008638858795166 Test1 is 13.26 faster than Test2
Output for 5.0.2
test1: -0.0093350410461426 test2: -0.0081779956817627 Test1 is 14.15 faster than Test2
Output for 5.0.1
test1: -0.01064395904541 test2: -0.0082988739013672 Test1 is 28.26 faster than Test2
Output for 5.0.0
test1: -0.011190891265869 test2: -0.010242938995361 Test1 is 9.25 faster than Test2
Output for 4.4.9
test1: -0.007601 test2: -0.006858 Test1 is 10.83 faster than Test2
Output for 4.4.8
test1: -0.005712 test2: -0.005556 Test1 is 2.81 faster than Test2
Output for 4.4.7
test1: -0.0094759999999999 test2: -0.008143 Test1 is 16.37 faster than Test2
Output for 4.4.6
test1: -0.012324 test2: -0.010867 Test1 is 13.41 faster than Test2
Output for 4.4.5
test1: -0.012472 test2: -0.009829 Test1 is 26.89 faster than Test2
Output for 4.4.4
test1: -0.00978 test2: -0.008508 Test1 is 14.95 faster than Test2
Output for 4.4.3
test1: -0.006498 test2: -0.005825 Test1 is 11.55 faster than Test2
Output for 4.4.2
test1: -0.006068 test2: -0.0052199999999999 Test1 is 16.25 faster than Test2
Output for 4.4.1
test1: -0.009919 test2: -0.008926 Test1 is 11.12 faster than Test2
Output for 4.4.0
test1: -0.008955 test2: -0.006336 Test1 is 41.34 faster than Test2
Output for 4.3.11
test1: -0.011896 test2: -0.010179 Test1 is 16.87 faster than Test2
Output for 4.3.10
test1: -0.011141 test2: -0.0097980000000001 Test1 is 13.71 faster than Test2
Output for 4.3.9
test1: -0.007408 test2: -0.0065149999999999 Test1 is 13.71 faster than Test2
Output for 4.3.8
test1: -0.011352 test2: -0.009805 Test1 is 15.78 faster than Test2
Output for 4.3.7
test1: -0.00771 test2: -0.006997 Test1 is 10.19 faster than Test2
Output for 4.3.6
test1: -0.009843 test2: -0.008616 Test1 is 14.24 faster than Test2
Output for 4.3.5
test1: -0.013323 test2: -0.010989 Test1 is 21.24 faster than Test2
Output for 4.3.4
test1: -0.009582 test2: -0.008502 Test1 is 12.7 faster than Test2
Output for 4.3.3
test1: 0.988819 test2: -0.009802
Output for 4.3.2
test1: -0.012303 test2: -0.010102 Test1 is 21.79 faster than Test2
Output for 4.3.1
test1: -0.010987 test2: -0.009955 Test1 is 10.37 faster than Test2
Output for 4.3.0
test1: -0.012299 test2: -0.010671 Test1 is 15.26 faster than Test2