3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $iterations = 1000000; $strOne = '1'; $strEmpty = ''; $times = ['oneOpEq' => 0, 'oneSlen' => 0, 'empOpEq' => 0, 'empSlen' => 0]; $x = $iterations; $start = microtime(true); while ($x--) { $y = ($strOne === '1'); } $times['oneOpEq'] = microtime(true) - $start; $x = $iterations; $start = microtime(true); while ($x--) { $y = (strlen($strOne) == 0); } $times['oneSlen'] = microtime(true) - $start; $x = $iterations; $start = microtime(true); while ($x--) { $y = ($strEmpty === ''); } $times['empOpEq'] = microtime(true) - $start; $x = $iterations; $start = microtime(true); while ($x--) { $y = (strlen($strEmpty) == 0); } $times['empSlen'] = microtime(true) - $start; var_dump($times);
Output for 7.2.6
array(4) { ["oneOpEq"]=> float(0.016729116439819) ["oneSlen"]=> float(0.014266014099121) ["empOpEq"]=> float(0.016536951065063) ["empSlen"]=> float(0.013845920562744) }
Output for 7.2.0
array(4) { ["oneOpEq"]=> float(0.016804933547974) ["oneSlen"]=> float(0.017312049865723) ["empOpEq"]=> float(0.016589164733887) ["empSlen"]=> float(0.015583992004395) }
Output for 7.1.10
array(4) { ["oneOpEq"]=> float(0.018525838851929) ["oneSlen"]=> float(0.018064022064209) ["empOpEq"]=> float(0.018086910247803) ["empSlen"]=> float(0.017051935195923) }
Output for 7.1.7
array(4) { ["oneOpEq"]=> float(0.032723903656006) ["oneSlen"]=> float(0.030592918395996) ["empOpEq"]=> float(0.02552604675293) ["empSlen"]=> float(0.027255058288574) }
Output for 7.1.6
array(4) { ["oneOpEq"]=> float(0.029396057128906) ["oneSlen"]=> float(0.026736974716187) ["empOpEq"]=> float(0.028745174407959) ["empSlen"]=> float(0.037178039550781) }
Output for 7.1.5
array(4) { ["oneOpEq"]=> float(0.032522916793823) ["oneSlen"]=> float(0.028096914291382) ["empOpEq"]=> float(0.036696910858154) ["empSlen"]=> float(0.028213024139404) }
Output for 7.1.4
array(4) { ["oneOpEq"]=> float(0.035126924514771) ["oneSlen"]=> float(0.033313989639282) ["empOpEq"]=> float(0.037918090820312) ["empSlen"]=> float(0.031320095062256) }
Output for 7.1.3
array(4) { ["oneOpEq"]=> float(0.029388904571533) ["oneSlen"]=> float(0.0244300365448) ["empOpEq"]=> float(0.030466079711914) ["empSlen"]=> float(0.023080110549927) }
Output for 7.1.2
array(4) { ["oneOpEq"]=> float(0.036012172698975) ["oneSlen"]=> float(0.024401187896729) ["empOpEq"]=> float(0.029290914535522) ["empSlen"]=> float(0.023334980010986) }
Output for 7.1.1
array(4) { ["oneOpEq"]=> float(0.06153678894043) ["oneSlen"]=> float(0.040121078491211) ["empOpEq"]=> float(0.076371908187866) ["empSlen"]=> float(0.045336961746216) }
Output for 7.1.0
array(4) { ["oneOpEq"]=> float(0.030272006988525) ["oneSlen"]=> float(0.025357007980347) ["empOpEq"]=> float(0.031759023666382) ["empSlen"]=> float(0.023478984832764) }
Output for 7.0.20
array(4) { ["oneOpEq"]=> float(0.025657892227173) ["oneSlen"]=> float(0.025802135467529) ["empOpEq"]=> float(0.024417161941528) ["empSlen"]=> float(0.024781942367554) }
Output for 7.0.19
array(4) { ["oneOpEq"]=> float(0.025600910186768) ["oneSlen"]=> float(0.023639917373657) ["empOpEq"]=> float(0.037423133850098) ["empSlen"]=> float(0.048133850097656) }
Output for 7.0.18
array(4) { ["oneOpEq"]=> float(0.026084899902344) ["oneSlen"]=> float(0.022593021392822) ["empOpEq"]=> float(0.030997037887573) ["empSlen"]=> float(0.034973859786987) }
Output for 7.0.17
array(4) { ["oneOpEq"]=> float(0.032726049423218) ["oneSlen"]=> float(0.022842884063721) ["empOpEq"]=> float(0.025635004043579) ["empSlen"]=> float(0.022516965866089) }
Output for 7.0.16
array(4) { ["oneOpEq"]=> float(0.026955127716064) ["oneSlen"]=> float(0.025012016296387) ["empOpEq"]=> float(0.027358055114746) ["empSlen"]=> float(0.023482084274292) }
Output for 7.0.15
array(4) { ["oneOpEq"]=> float(0.056813955307007) ["oneSlen"]=> float(0.032196998596191) ["empOpEq"]=> float(0.029322147369385) ["empSlen"]=> float(0.029371023178101) }
Output for 7.0.14
array(4) { ["oneOpEq"]=> float(0.024879932403564) ["oneSlen"]=> float(0.022589921951294) ["empOpEq"]=> float(0.024513959884644) ["empSlen"]=> float(0.021779775619507) }
Output for 7.0.13
array(4) { ["oneOpEq"]=> float(0.025294065475464) ["oneSlen"]=> float(0.022185087203979) ["empOpEq"]=> float(0.025262117385864) ["empSlen"]=> float(0.023017883300781) }
Output for 7.0.12
array(4) { ["oneOpEq"]=> float(0.025295972824097) ["oneSlen"]=> float(0.022511005401611) ["empOpEq"]=> float(0.024816989898682) ["empSlen"]=> float(0.022406816482544) }
Output for 7.0.11
array(4) { ["oneOpEq"]=> float(0.026081085205078) ["oneSlen"]=> float(0.022335052490234) ["empOpEq"]=> float(0.025041818618774) ["empSlen"]=> float(0.024131059646606) }
Output for 7.0.10
array(4) { ["oneOpEq"]=> float(0.026671886444092) ["oneSlen"]=> float(0.023354053497314) ["empOpEq"]=> float(0.025081157684326) ["empSlen"]=> float(0.022243022918701) }
Output for 7.0.9
array(4) { ["oneOpEq"]=> float(0.025857925415039) ["oneSlen"]=> float(0.024524927139282) ["empOpEq"]=> float(0.025684118270874) ["empSlen"]=> float(0.025605916976929) }
Output for 7.0.8
array(4) { ["oneOpEq"]=> float(0.031337976455688) ["oneSlen"]=> float(0.023160934448242) ["empOpEq"]=> float(0.026284217834473) ["empSlen"]=> float(0.023903131484985) }
Output for 7.0.7
array(4) { ["oneOpEq"]=> float(0.029094934463501) ["oneSlen"]=> float(0.022072792053223) ["empOpEq"]=> float(0.031200885772705) ["empSlen"]=> float(0.032700061798096) }
Output for 7.0.6
array(4) { ["oneOpEq"]=> float(0.024235010147095) ["oneSlen"]=> float(0.022751808166504) ["empOpEq"]=> float(0.025251865386963) ["empSlen"]=> float(0.02153205871582) }
Output for 7.0.5
array(4) { ["oneOpEq"]=> float(0.031850099563599) ["oneSlen"]=> float(0.037204027175903) ["empOpEq"]=> float(0.034294128417969) ["empSlen"]=> float(0.025596141815186) }
Output for 7.0.4
array(4) { ["oneOpEq"]=> float(0.04134202003479) ["oneSlen"]=> float(0.022659063339233) ["empOpEq"]=> float(0.041918992996216) ["empSlen"]=> float(0.027498006820679) }
Output for 7.0.3
array(4) { ["oneOpEq"]=> float(0.058549165725708) ["oneSlen"]=> float(0.10899591445923) ["empOpEq"]=> float(0.078180074691772) ["empSlen"]=> float(0.050270080566406) }
Output for 7.0.2
array(4) { ["oneOpEq"]=> float(0.038369178771973) ["oneSlen"]=> float(0.022993087768555) ["empOpEq"]=> float(0.025337934494019) ["empSlen"]=> float(0.023512840270996) }
Output for 7.0.1
array(4) { ["oneOpEq"]=> float(0.034267902374268) ["oneSlen"]=> float(0.024699926376343) ["empOpEq"]=> float(0.027529954910278) ["empSlen"]=> float(0.026640892028809) }
Output for 7.0.0
array(4) { ["oneOpEq"]=> float(0.047035932540894) ["oneSlen"]=> float(0.028259992599487) ["empOpEq"]=> float(0.025225877761841) ["empSlen"]=> float(0.025171041488647) }
Output for hhvm-3.15.4
array(4) { ["oneOpEq"]=> float(0.063931941986084) ["oneSlen"]=> float(0.13016510009766) ["empOpEq"]=> float(0.060720920562744) ["empSlen"]=> float(0.11105680465698) }
Output for 5.6.30
array(4) { ["oneOpEq"]=> float(0.06368088722229) ["oneSlen"]=> float(0.21223092079163) ["empOpEq"]=> float(0.093456029891968) ["empSlen"]=> float(0.14854216575623) }
Output for 5.6.29
array(4) { ["oneOpEq"]=> float(0.038810968399048) ["oneSlen"]=> float(0.12897896766663) ["empOpEq"]=> float(0.043201208114624) ["empSlen"]=> float(0.11158919334412) }
Output for 5.6.28
array(4) { ["oneOpEq"]=> float(0.054894924163818) ["oneSlen"]=> float(0.10929703712463) ["empOpEq"]=> float(0.035856962203979) ["empSlen"]=> float(0.11837601661682) }
Output for 5.6.27
array(4) { ["oneOpEq"]=> float(0.048742055892944) ["oneSlen"]=> float(0.11153888702393) ["empOpEq"]=> float(0.035016059875488) ["empSlen"]=> float(0.11721801757812) }
Output for 5.6.26
array(4) { ["oneOpEq"]=> float(0.034398794174194) ["oneSlen"]=> float(0.10434699058533) ["empOpEq"]=> float(0.034672975540161) ["empSlen"]=> float(0.10546493530273) }
Output for 5.6.25
array(4) { ["oneOpEq"]=> float(0.038858890533447) ["oneSlen"]=> float(0.10379409790039) ["empOpEq"]=> float(0.035371065139771) ["empSlen"]=> float(0.10535407066345) }
Output for 5.6.24
array(4) { ["oneOpEq"]=> float(0.04141092300415) ["oneSlen"]=> float(0.10858488082886) ["empOpEq"]=> float(0.037463903427124) ["empSlen"]=> float(0.10769081115723) }
Output for 5.6.23
array(4) { ["oneOpEq"]=> float(0.037935972213745) ["oneSlen"]=> float(0.13211512565613) ["empOpEq"]=> float(0.035338163375854) ["empSlen"]=> float(0.11066007614136) }
Output for 5.6.22
array(4) { ["oneOpEq"]=> float(0.043056964874268) ["oneSlen"]=> float(0.12387013435364) ["empOpEq"]=> float(0.037471055984497) ["empSlen"]=> float(0.10567092895508) }
Output for 5.6.21
array(4) { ["oneOpEq"]=> float(0.078451871871948) ["oneSlen"]=> float(0.1298520565033) ["empOpEq"]=> float(0.058779001235962) ["empSlen"]=> float(0.13654899597168) }
Output for 5.6.20
array(4) { ["oneOpEq"]=> float(0.035475969314575) ["oneSlen"]=> float(0.14390301704407) ["empOpEq"]=> float(0.035457134246826) ["empSlen"]=> float(0.15865707397461) }
Output for 5.6.19
array(4) { ["oneOpEq"]=> float(0.038295030593872) ["oneSlen"]=> float(0.12819910049438) ["empOpEq"]=> float(0.038487911224365) ["empSlen"]=> float(0.12826085090637) }
Output for 5.6.18
array(4) { ["oneOpEq"]=> float(0.064558029174805) ["oneSlen"]=> float(0.15474510192871) ["empOpEq"]=> float(0.035454034805298) ["empSlen"]=> float(0.11529302597046) }
Output for 5.6.17
array(4) { ["oneOpEq"]=> float(0.060200929641724) ["oneSlen"]=> float(0.18257904052734) ["empOpEq"]=> float(0.042973041534424) ["empSlen"]=> float(0.1357638835907) }
Output for 5.6.16
array(4) { ["oneOpEq"]=> float(0.035768985748291) ["oneSlen"]=> float(0.11916089057922) ["empOpEq"]=> float(0.043065071105957) ["empSlen"]=> float(0.11101317405701) }
Output for 5.6.15
array(4) { ["oneOpEq"]=> float(0.039527177810669) ["oneSlen"]=> float(0.1210470199585) ["empOpEq"]=> float(0.03916597366333) ["empSlen"]=> float(0.14017486572266) }
Output for 5.6.14
array(4) { ["oneOpEq"]=> float(0.054459810256958) ["oneSlen"]=> float(0.11632108688354) ["empOpEq"]=> float(0.036041021347046) ["empSlen"]=> float(0.10792183876038) }
Output for 5.6.13
array(4) { ["oneOpEq"]=> float(0.039796829223633) ["oneSlen"]=> float(0.11481094360352) ["empOpEq"]=> float(0.037152051925659) ["empSlen"]=> float(0.11321997642517) }
Output for 5.6.12
array(4) { ["oneOpEq"]=> float(0.052919864654541) ["oneSlen"]=> float(0.10807299613953) ["empOpEq"]=> float(0.035615921020508) ["empSlen"]=> float(0.11072111129761) }
Output for 5.6.11
array(4) { ["oneOpEq"]=> float(0.037322044372559) ["oneSlen"]=> float(0.10972905158997) ["empOpEq"]=> float(0.035195112228394) ["empSlen"]=> float(0.11374378204346) }
Output for 5.6.10
array(4) { ["oneOpEq"]=> float(0.060405015945435) ["oneSlen"]=> float(0.18598389625549) ["empOpEq"]=> float(0.037589073181152) ["empSlen"]=> float(0.10643196105957) }
Output for 5.6.9
array(4) { ["oneOpEq"]=> float(0.040148973464966) ["oneSlen"]=> float(0.11834788322449) ["empOpEq"]=> float(0.04413104057312) ["empSlen"]=> float(0.14952111244202) }
Output for 5.6.8
array(4) { ["oneOpEq"]=> float(0.03792405128479) ["oneSlen"]=> float(0.11122298240662) ["empOpEq"]=> float(0.037255048751831) ["empSlen"]=> float(0.12106513977051) }
Output for 5.6.7
array(4) { ["oneOpEq"]=> float(0.043378829956055) ["oneSlen"]=> float(0.10697293281555) ["empOpEq"]=> float(0.035058975219727) ["empSlen"]=> float(0.11106395721436) }
Output for 5.6.6
array(4) { ["oneOpEq"]=> float(0.034239053726196) ["oneSlen"]=> float(0.10314989089966) ["empOpEq"]=> float(0.034922122955322) ["empSlen"]=> float(0.10694694519043) }
Output for 5.6.5
array(4) { ["oneOpEq"]=> float(0.034840106964111) ["oneSlen"]=> float(0.10118579864502) ["empOpEq"]=> float(0.035316944122314) ["empSlen"]=> float(0.10130000114441) }
Output for 5.6.4
array(4) { ["oneOpEq"]=> float(0.034587860107422) ["oneSlen"]=> float(0.10498285293579) ["empOpEq"]=> float(0.03476095199585) ["empSlen"]=> float(0.1094970703125) }
Output for 5.6.3
array(4) { ["oneOpEq"]=> float(0.052290916442871) ["oneSlen"]=> float(0.12706089019775) ["empOpEq"]=> float(0.042929887771606) ["empSlen"]=> float(0.12488293647766) }
Output for 5.6.2
array(4) { ["oneOpEq"]=> float(0.035017967224121) ["oneSlen"]=> float(0.10938382148743) ["empOpEq"]=> float(0.038045883178711) ["empSlen"]=> float(0.1060209274292) }
Output for 5.6.1
array(4) { ["oneOpEq"]=> float(0.035672903060913) ["oneSlen"]=> float(0.10437488555908) ["empOpEq"]=> float(0.037703037261963) ["empSlen"]=> float(0.10452008247375) }
Output for 5.6.0
array(4) { ["oneOpEq"]=> float(0.037091016769409) ["oneSlen"]=> float(0.107173204422) ["empOpEq"]=> float(0.042659044265747) ["empSlen"]=> float(0.10632085800171) }