3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<? $n=9999999; $a=1; $b=2; $start=microtime(1); for($i=1;$i<=$n;$i++) { if ($a!=$b) $c=$a+$b;else $c=8; } print 'normal: '.(microtime(1)-$start)."<br>\n"; $start=microtime(1); for($i=1;$i<=$n;$i++) { $c=($a!=$b)?($a+$b):8; } print 'ternary: '.(microtime(1)-$start)."<br>\n";
Output for 7.1.0
normal: 0.30024600028992<br> ternary: 0.13387894630432<br>
Output for 7.0.14
normal: 0.21850204467773<br> ternary: 0.20769906044006<br>
Output for 7.0.8
normal: 0.1864869594574<br> ternary: 0.18132996559143<br>
Output for 7.0.7
normal: 0.18928098678589<br> ternary: 0.17276191711426<br>
Output for 7.0.6
normal: 0.15035700798035<br> ternary: 0.14040613174438<br>
Output for 7.0.5
normal: 0.19859099388123<br> ternary: 0.19091200828552<br>
Output for 7.0.4
normal: 0.19038796424866<br> ternary: 0.17677402496338<br>
Output for 7.0.3
normal: 0.19026708602905<br> ternary: 0.18440103530884<br>
Output for 7.0.2
normal: 0.19385194778442<br> ternary: 0.17419695854187<br>
Output for 7.0.1
normal: 0.18426489830017<br> ternary: 0.18705296516418<br>
Output for 7.0.0
normal: 0.20749092102051<br> ternary: 0.18763709068298<br>
Output for 5.6.28
normal: 0.53096699714661<br> ternary: 0.65017104148865<br>
Output for 5.6.23
normal: 0.43268895149231<br> ternary: 0.43367409706116<br>
Output for 5.6.22
normal: 0.41345500946045<br> ternary: 0.41366410255432<br>
Output for 5.6.21
normal: 0.46966409683228<br> ternary: 0.44129395484924<br>
Output for 5.6.20
normal: 0.3466911315918<br> ternary: 0.35621309280396<br>
Output for 5.6.19
normal: 0.45937490463257<br> ternary: 0.45260000228882<br>
Output for 5.6.18
normal: 0.46830701828003<br> ternary: 0.42976212501526<br>
Output for 5.6.17
normal: 0.42188405990601<br> ternary: 0.42176818847656<br>
Output for 5.6.16
normal: 0.43310689926147<br> ternary: 0.44655084609985<br>
Output for 5.6.15
normal: 0.4199800491333<br> ternary: 0.44258785247803<br>
Output for 5.6.14
normal: 0.41165018081665<br> ternary: 0.40916204452515<br>
Output for 5.6.13
normal: 0.44165682792664<br> ternary: 0.45105385780334<br>
Output for 5.6.12
normal: 0.3375198841095<br> ternary: 0.3561749458313<br>
Output for 5.6.11
normal: 0.34327292442322<br> ternary: 0.35607695579529<br>
Output for 5.6.10
normal: 0.39688396453857<br> ternary: 0.35986709594727<br>
Output for 5.6.9
normal: 0.42791986465454<br> ternary: 0.43031811714172<br>
Output for 5.6.8
normal: 0.41724300384521<br> ternary: 0.42104196548462<br>
Output for 5.6.7
normal: 0.46284222602844<br> ternary: 0.42907285690308<br>
Output for 5.6.6
normal: 0.40898108482361<br> ternary: 0.35335993766785<br>
Output for 5.6.5
normal: 0.34429788589478<br> ternary: 0.3571879863739<br>
Output for 5.6.4
normal: 0.42418003082275<br> ternary: 0.42821884155273<br>
Output for 5.6.3
normal: 0.44279193878174<br> ternary: 0.4611759185791<br>
Output for 5.6.2
normal: 0.44190907478333<br> ternary: 0.43221998214722<br>
Output for 5.6.1
normal: 0.43926811218262<br> ternary: 0.43307185173035<br>
Output for 5.6.0
normal: 0.3832049369812<br> ternary: 0.42841005325317<br>
Output for 5.5.37
normal: 0.39259004592896<br> ternary: 0.39938807487488<br>
Output for 5.5.36
normal: 0.41955900192261<br> ternary: 0.42577219009399<br>
Output for 5.5.35
normal: 0.35225486755371<br> ternary: 0.36017489433289<br>
Output for 5.5.34
normal: 0.43106603622437<br> ternary: 0.43489503860474<br>
Output for 5.5.33
normal: 0.44847893714905<br> ternary: 0.43128204345703<br>
Output for 5.5.32
normal: 0.43408918380737<br> ternary: 0.40104913711548<br>
Output for 5.5.31
normal: 0.42961406707764<br> ternary: 0.43405985832214<br>
Output for 5.5.30
normal: 0.45017719268799<br> ternary: 0.43608903884888<br>
Output for 5.5.29
normal: 0.36185789108276<br> ternary: 0.37574410438538<br>
Output for 5.5.28
normal: 0.42436194419861<br> ternary: 0.4260790348053<br>
Output for 5.5.27
normal: 0.3817880153656<br> ternary: 0.35403299331665<br>
Output for 5.5.26
normal: 0.40654611587524<br> ternary: 0.35479784011841<br>
Output for 5.5.25
normal: 0.42819499969482<br> ternary: 0.43033313751221<br>
Output for 5.5.24
normal: 0.38688707351685<br> ternary: 0.37038612365723<br>
Output for 5.5.23
normal: 0.34220099449158<br> ternary: 0.36160683631897<br>
Output for 5.5.22
normal: 0.43189597129822<br> ternary: 0.43288898468018<br>
Output for 5.5.21
normal: 0.37395191192627<br> ternary: 0.36846089363098<br>
Output for 5.5.20
normal: 0.34480309486389<br> ternary: 0.35806488990784<br>
Output for 5.5.19
normal: 0.43295907974243<br> ternary: 0.43115997314453<br>
Output for 5.5.18
normal: 0.44358015060425<br> ternary: 0.42783999443054<br>
Output for 5.5.16
normal: 0.44087696075439<br> ternary: 0.43430685997009<br>
Output for 5.5.15
normal: 0.42981505393982<br> ternary: 0.43110990524292<br>
Output for 5.5.14
normal: 0.3827691078186<br> ternary: 0.35274982452393<br>
Output for 5.5.13
normal: 0.44562196731567<br> ternary: 0.42962694168091<br>
Output for 5.5.12
normal: 0.34646201133728<br> ternary: 0.35768818855286<br>
Output for 5.5.11
normal: 0.41399693489075<br> ternary: 0.42163801193237<br>
Output for 5.5.10
normal: 0.43908286094666<br> ternary: 0.43007111549377<br>
Output for 5.5.9
normal: 0.44981098175049<br> ternary: 0.42038512229919<br>
Output for 5.5.8
normal: 0.43634009361267<br> ternary: 0.3565399646759<br>
Output for 5.5.7
normal: 0.41712284088135<br> ternary: 0.40611791610718<br>
Output for 5.5.6
normal: 0.41187286376953<br> ternary: 0.40137815475464<br>
Output for 5.5.5
normal: 0.41248297691345<br> ternary: 0.40446996688843<br>
Output for 5.5.4
normal: 0.43156886100769<br> ternary: 0.42160511016846<br>
Output for 5.5.3
normal: 0.38602709770203<br> ternary: 0.40954804420471<br>
Output for 5.5.2
normal: 0.33982801437378<br> ternary: 0.35986709594727<br>
Output for 5.5.1
normal: 0.33720707893372<br> ternary: 0.35669279098511<br>
Output for 5.5.0
normal: 0.42098188400269<br> ternary: 0.41839909553528<br>
Output for 5.4.45
normal: 0.36532211303711<br> ternary: 0.38075184822083<br>
Output for 5.4.44
normal: 0.40884399414062<br> ternary: 0.36305499076843<br>
Output for 5.4.43
normal: 0.44082593917847<br> ternary: 0.43792915344238<br>
Output for 5.4.42
normal: 0.38615107536316<br> ternary: 0.41019701957703<br>
Output for 5.4.41
normal: 0.44318389892578<br> ternary: 0.43907904624939<br>
Output for 5.4.40
normal: 0.4267852306366<br> ternary: 0.46310496330261<br>
Output for 5.4.39
normal: 0.44010806083679<br> ternary: 0.44978594779968<br>
Output for 5.4.38
normal: 0.41646599769592<br> ternary: 0.42211294174194<br>
Output for 5.4.37
normal: 0.33889508247375<br> ternary: 0.36150121688843<br>
Output for 5.4.36
normal: 0.42623090744019<br> ternary: 0.42607092857361<br>
Output for 5.4.35
normal: 0.45511102676392<br> ternary: 0.46785497665405<br>
Output for 5.4.34
normal: 0.43716907501221<br> ternary: 0.44068503379822<br>
Output for 5.4.32
normal: 0.44649195671082<br> ternary: 0.43952703475952<br>
Output for 5.4.31
normal: 0.44994616508484<br> ternary: 0.43904304504395<br>
Output for 5.4.30
normal: 0.46995186805725<br> ternary: 0.47743797302246<br>
Output for 5.4.29
normal: 0.44770693778992<br> ternary: 0.43767905235291<br>
Output for 5.4.28
normal: 0.36494493484497<br> ternary: 0.3784339427948<br>
Output for 5.4.27
normal: 0.424800157547<br> ternary: 0.47437596321106<br>
Output for 5.4.26
normal: 0.36259508132935<br> ternary: 0.38048505783081<br>
Output for 5.4.25
normal: 0.41424202919006<br> ternary: 0.4619779586792<br>
Output for 5.4.24
normal: 0.42102098464966<br> ternary: 0.42173314094543<br>
Output for 5.4.23
normal: 0.42780590057373<br> ternary: 0.36588001251221<br>
Output for 5.4.22
normal: 0.42946791648865<br> ternary: 0.44073510169983<br>
Output for 5.4.21
normal: 0.42273497581482<br> ternary: 0.47525310516357<br>
Output for 5.4.20
normal: 0.34059286117554<br> ternary: 0.36359095573425<br>
Output for 5.4.19
normal: 0.3914361000061<br> ternary: 0.42432188987732<br>
Output for 5.4.18
normal: 0.34498190879822<br> ternary: 0.36204290390015<br>
Output for 5.4.17
normal: 0.3411009311676<br> ternary: 0.36759686470032<br>
Output for 5.4.16
normal: 0.42521095275879<br> ternary: 0.4276819229126<br>
Output for 5.4.15
normal: 0.42376112937927<br> ternary: 0.43434500694275<br>
Output for 5.4.14
normal: 0.35083293914795<br> ternary: 0.36288595199585<br>
Output for 5.4.13
normal: 0.42429304122925<br> ternary: 0.37368488311768<br>
Output for 5.4.12
normal: 0.40991806983948<br> ternary: 0.37762093544006<br>
Output for 5.4.11
normal: 0.43685603141785<br> ternary: 0.44751501083374<br>
Output for 5.4.10
normal: 0.4237060546875<br> ternary: 0.44725394248962<br>
Output for 5.4.9
normal: 0.43507599830627<br> ternary: 0.44971990585327<br>
Output for 5.4.8
normal: 0.42079377174377<br> ternary: 0.41645812988281<br>
Output for 5.4.7
normal: 0.42728686332703<br> ternary: 0.43406510353088<br>
Output for 5.4.6
normal: 0.44642114639282<br> ternary: 0.44071102142334<br>
Output for 5.4.5
normal: 0.4255850315094<br> ternary: 0.41770195960999<br>
Output for 5.4.4
normal: 0.50125408172607<br> ternary: 0.46233701705933<br>
Output for 5.4.3
normal: 0.43034505844116<br> ternary: 0.46457195281982<br>
Output for 5.4.2
normal: 0.43416595458984<br> ternary: 0.42962408065796<br>
Output for 5.4.1
normal: 0.42426300048828<br> ternary: 0.41965198516846<br>
Output for 5.4.0
normal: 0.36062288284302<br> ternary: 0.38815212249756<br>
Output for 4.3.0 - 5.3.29
<? $n=9999999; $a=1; $b=2; $start=microtime(1); for($i=1;$i<=$n;$i++) { if ($a!=$b) $c=$a+$b;else $c=8; } print 'normal: '.(microtime(1)-$start)."<br>\n"; $start=microtime(1); for($i=1;$i<=$n;$i++) { $c=($a!=$b)?($a+$b):8; } print 'ternary: '.(microtime(1)-$start)."<br>\n";