3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(0); $amount = 100000; $start = microtime(true); for($i = 0; $i < $amount ; $i++) { $alreadyOutput = array(); foreach ($results as $result) { if(in_array($result->date, $alreadyOutput)){ continue; } $alreadyOutput[] = $result->date; echo $result->date . "<br />"; } } echo "in_array: ".(microtime(true) - $start)."ms || "; $start2 = microtime(true); for($i = 0; $i < $amount ; $i++) { $echoedArray = array(); foreach ($results as $result) { if ($echoedArray[$result->date]) { continue; } echo $result->date . "<br />"; $echoedArray[$result->date] = true; } } echo "by key: ".(microtime(true) - $start2)."ms";
based on nQZbc
Output for 7.1.0
in_array: 0.06306004524231ms || by key: 0.066978931427002ms
Output for 7.0.14
in_array: -0.021985054016113ms || by key: -0.051690816879272ms
Output for 7.0.6
in_array: 0.052170991897583ms || by key: 0.044360876083374ms
Output for 7.0.5
in_array: 0.045156955718994ms || by key: 0.039129018783569ms
Output for 7.0.4
in_array: 0.047951936721802ms || by key: 0.039700984954834ms
Output for 7.0.3
in_array: 0.044888019561768ms || by key: 0.038275003433228ms
Output for 7.0.2
in_array: 0.047147035598755ms || by key: 0.048671007156372ms
Output for 7.0.1
in_array: 0.035709857940674ms || by key: 0.035706043243408ms
Output for 7.0.0
in_array: 0.047066926956177ms || by key: 0.039089918136597ms
Output for 5.6.28
in_array: 0.066830158233643ms || by key: 0.05596399307251ms
Output for 5.6.21
in_array: 0.044234991073608ms || by key: 0.040878057479858ms
Output for 5.6.20
in_array: 0.050226211547852ms || by key: 0.041928052902222ms
Output for 5.6.19
in_array: 0.05462384223938ms || by key: 0.043839931488037ms
Output for 5.6.18
in_array: 0.042147874832153ms || by key: 0.038470983505249ms
Output for 5.6.17
in_array: 0.043207883834839ms || by key: 0.03843092918396ms
Output for 5.6.16
in_array: 0.042825937271118ms || by key: 0.036356925964355ms
Output for 5.6.15
in_array: 0.049015045166016ms || by key: 0.042514085769653ms
Output for 5.6.14
in_array: 0.05012321472168ms || by key: 0.044100999832153ms
Output for 5.6.13
in_array: 0.038073778152466ms || by key: 0.037738084793091ms
Output for 5.6.12
in_array: 0.046704053878784ms || by key: 0.037650108337402ms
Output for 5.6.11
in_array: 0.041119813919067ms || by key: 0.040539979934692ms
Output for 5.6.10
in_array: 0.037028074264526ms || by key: 0.03574013710022ms
Output for 5.6.9
in_array: 0.046733856201172ms || by key: 0.038025140762329ms
Output for 5.6.8
in_array: 0.055279970169067ms || by key: 0.047904014587402ms
Output for 5.5.35
in_array: 0.038131952285767ms || by key: 0.037445068359375ms
Output for 5.5.34
in_array: 0.051531076431274ms || by key: 0.040712118148804ms
Output for 5.5.33
in_array: 0.051663875579834ms || by key: 0.043127775192261ms
Output for 5.5.32
in_array: 0.048882961273193ms || by key: 0.041506052017212ms
Output for 5.5.31
in_array: 0.044312000274658ms || by key: 0.036777019500732ms
Output for 5.5.30
in_array: 0.049376010894775ms || by key: 0.042568922042847ms
Output for 5.5.29
in_array: 0.036880970001221ms || by key: 0.036749124526978ms
Output for 5.5.28
in_array: 0.052234172821045ms || by key: 0.040037155151367ms
Output for 5.5.27
in_array: 0.043311834335327ms || by key: 0.042703866958618ms
Output for 5.5.26
in_array: 0.052215099334717ms || by key: 0.043375015258789ms
Output for 5.5.25
in_array: 0.052332878112793ms || by key: 0.043210983276367ms
Output for 5.5.24
in_array: 0.036601781845093ms || by key: 0.036412954330444ms
Output for 5.4.45
in_array: 0.039929866790771ms || by key: 0.038367033004761ms
Output for 5.4.44
in_array: 0.056554079055786ms || by key: 0.057653903961182ms
Output for 5.4.43
in_array: 0.10100507736206ms || by key: 0.051423788070679ms
Output for 5.4.42
in_array: 0.1179039478302ms || by key: 0.12517714500427ms
Output for 5.4.41
in_array: 0.063020944595337ms || by key: 0.053481101989746ms
Output for 5.4.40
in_array: 0.064226865768433ms || by key: 0.061122894287109ms
Output for 5.4.39
in_array: 0.11770701408386ms || by key: 0.17171406745911ms
Output for 5.4.38
in_array: 0.060847997665405ms || by key: 0.06629204750061ms
Output for 5.4.37
in_array: 0.060477018356323ms || by key: 0.059085130691528ms
Output for 5.4.36
in_array: 0.070338010787964ms || by key: 0.060905933380127ms
Output for 5.4.35
in_array: 0.054199934005737ms || by key: 0.061188936233521ms
Output for 5.4.34
in_array: 0.058626890182495ms || by key: 0.066298007965088ms
Output for 5.4.32
in_array: 0.04225492477417ms || by key: 0.042649030685425ms
Output for 5.4.31
in_array: 0.046310901641846ms || by key: 0.046005010604858ms
Output for 5.4.30
in_array: 0.042276859283447ms || by key: 0.042732000350952ms
Output for 5.4.29
in_array: 0.042743921279907ms || by key: 0.044458866119385ms
Output for 5.4.28
in_array: 0.046191215515137ms || by key: 0.047353029251099ms
Output for 5.4.27
in_array: 0.047075986862183ms || by key: 0.046561002731323ms
Output for 5.4.26
in_array: 0.040322065353394ms || by key: 0.041039943695068ms
Output for 5.4.25
in_array: 0.041458129882812ms || by key: 0.041294097900391ms
Output for 5.4.24
in_array: 0.044574022293091ms || by key: 0.044725894927979ms
Output for 5.4.23
in_array: 0.048984050750732ms || by key: 0.049331903457642ms
Output for 5.4.22
in_array: 0.042796850204468ms || by key: 0.046612024307251ms
Output for 5.4.21
in_array: 0.047373056411743ms || by key: 0.042585849761963ms
Output for 5.4.20
in_array: 0.039731979370117ms || by key: 0.047560930252075ms
Output for 5.4.19
in_array: 0.043501138687134ms || by key: 0.04256796836853ms
Output for 5.4.18
in_array: 0.042836904525757ms || by key: 0.043251037597656ms
Output for 5.4.17
in_array: 0.041883945465088ms || by key: 0.041959047317505ms
Output for 5.4.16
in_array: 0.043041944503784ms || by key: 0.043022871017456ms
Output for 5.4.15
in_array: 0.041990995407104ms || by key: 0.041961908340454ms
Output for 5.4.14
in_array: 0.040769100189209ms || by key: 0.044188976287842ms
Output for 5.4.13
in_array: 0.040179014205933ms || by key: 0.04042387008667ms
Output for 5.4.12
in_array: 0.046662092208862ms || by key: 0.04557204246521ms
Output for 5.4.11
in_array: 0.044148921966553ms || by key: 0.048119068145752ms
Output for 5.4.10
in_array: 0.044389009475708ms || by key: 0.044846057891846ms
Output for 5.4.9
in_array: 0.041951179504395ms || by key: 0.041290998458862ms
Output for 5.4.8
in_array: 0.04110312461853ms || by key: 0.046341180801392ms
Output for 5.4.7
in_array: 0.041507005691528ms || by key: 0.041810989379883ms
Output for 5.4.6
in_array: 0.044044971466064ms || by key: 0.049237966537476ms
Output for 5.4.5
in_array: 0.042153120040894ms || by key: 0.041730880737305ms
Output for 5.4.4
in_array: 0.04439902305603ms || by key: 0.042348861694336ms
Output for 5.4.3
in_array: 0.041388034820557ms || by key: 0.041041135787964ms
Output for 5.4.2
in_array: 0.041189193725586ms || by key: 0.041072845458984ms
Output for 5.4.1
in_array: 0.041022062301636ms || by key: 0.041486978530884ms
Output for 5.4.0
in_array: 0.04325795173645ms || by key: 0.043262004852295ms
Output for 5.3.29
in_array: 0.061356067657471ms || by key: 0.048352956771851ms
Output for 5.3.28
in_array: 0.049613952636719ms || by key: 0.048915863037109ms
Output for 5.3.27
in_array: 0.045019149780273ms || by key: 0.04525899887085ms
Output for 5.3.26
in_array: 0.044957160949707ms || by key: 0.048526048660278ms
Output for 5.3.25
in_array: 0.044473886489868ms || by key: 0.044752836227417ms
Output for 5.3.24
in_array: 0.044588804244995ms || by key: 0.0435950756073ms
Output for 5.3.23
in_array: 0.047515869140625ms || by key: 0.047846078872681ms
Output for 5.3.22
in_array: 0.044667959213257ms || by key: 0.045923948287964ms
Output for 5.3.21
in_array: 0.050426006317139ms || by key: 0.050738096237183ms
Output for 5.3.20
in_array: 0.045897006988525ms || by key: 0.044893026351929ms
Output for 5.3.19
in_array: 0.050009965896606ms || by key: 0.050974130630493ms
Output for 5.3.18
in_array: 0.044925212860107ms || by key: 0.0451340675354ms
Output for 5.3.17
in_array: 0.051676988601685ms || by key: 0.045192956924438ms
Output for 5.3.16
in_array: 0.045135021209717ms || by key: 0.045439004898071ms
Output for 5.3.15
in_array: 0.045625925064087ms || by key: 0.045331954956055ms
Output for 5.3.14
in_array: 0.045682907104492ms || by key: 0.045300006866455ms
Output for 5.3.13
in_array: 0.044610977172852ms || by key: 0.045083999633789ms
Output for 5.3.12
in_array: 0.04529595375061ms || by key: 0.045341968536377ms
Output for 5.3.11
in_array: 0.044280767440796ms || by key: 0.043661832809448ms
Output for 5.3.10
in_array: 0.043874979019165ms || by key: 0.043970108032227ms
Output for 5.3.9
in_array: 0.043682098388672ms || by key: 0.045017957687378ms
Output for 5.3.8
in_array: 0.044867038726807ms || by key: 0.043081045150757ms
Output for 5.3.7
in_array: 0.043311834335327ms || by key: 0.042326927185059ms
Output for 5.3.6
in_array: 0.043540000915527ms || by key: 0.042603969573975ms
Output for 5.3.5
in_array: 0.050829172134399ms || by key: 0.052591800689697ms
Output for 5.3.4
in_array: 0.043730974197388ms || by key: 0.044855833053589ms
Output for 5.3.3
in_array: 0.043735980987549ms || by key: 0.04512882232666ms
Output for 5.3.2
in_array: 0.052250862121582ms || by key: 0.046233892440796ms
Output for 5.3.1
in_array: 0.045289039611816ms || by key: 0.050189971923828ms
Output for 5.3.0
in_array: 0.042734861373901ms || by key: 0.043451070785522ms
Output for 5.2.17
in_array: 0.049038171768188ms || by key: 0.04834508895874ms
Output for 5.2.16
in_array: 0.049739837646484ms || by key: 0.048712015151978ms
Output for 5.2.15
in_array: 0.052531003952026ms || by key: 0.052181959152222ms
Output for 5.2.14
in_array: 0.057504892349243ms || by key: 0.056010961532593ms
Output for 5.2.13
in_array: 0.048040151596069ms || by key: 0.046592950820923ms
Output for 5.2.12
in_array: 0.060609102249146ms || by key: 0.050410985946655ms
Output for 5.2.11
in_array: 0.062242031097412ms || by key: 0.051194906234741ms
Output for 5.2.10
in_array: 0.052298069000244ms || by key: 0.05378794670105ms
Output for 5.2.9
in_array: 0.056596040725708ms || by key: 0.055577039718628ms
Output for 5.2.8
in_array: 0.048699140548706ms || by key: 0.046673059463501ms
Output for 5.2.7
in_array: 0.047005176544189ms || by key: 0.046433925628662ms
Output for 5.2.6
in_array: 0.053326845169067ms || by key: 0.054814100265503ms
Output for 5.2.5
in_array: 0.047790050506592ms || by key: 0.048193216323853ms
Output for 5.2.4
in_array: 0.046786069869995ms || by key: 0.049612045288086ms
Output for 5.2.3
in_array: 0.046332836151123ms || by key: 0.047655820846558ms
Output for 5.2.2
in_array: 0.047105073928833ms || by key: 0.046149015426636ms
Output for 5.2.1
in_array: 0.044401884078979ms || by key: 0.043686866760254ms
Output for 5.2.0
in_array: 0.052516937255859ms || by key: 0.052988052368164ms
Output for 5.1.6
in_array: 0.045958042144775ms || by key: 0.044282913208008ms
Output for 5.1.5
in_array: 0.046738862991333ms || by key: 0.046036958694458ms
Output for 5.1.4
in_array: 0.045128107070923ms || by key: 0.045809030532837ms
Output for 5.1.3
in_array: 0.048722982406616ms || by key: 0.048035860061646ms
Output for 5.1.2
in_array: 0.065102100372314ms || by key: 0.047705888748169ms
Output for 5.1.1
in_array: 0.051208972930908ms || by key: 0.05181097984314ms
Output for 5.1.0
in_array: 0.053110122680664ms || by key: 0.054252862930298ms
Output for 5.0.5
in_array: 0.052819967269897ms || by key: 0.050693988800049ms
Output for 5.0.4
in_array: 0.058565139770508ms || by key: 0.0556321144104ms
Output for 5.0.3
in_array: 0.049533843994141ms || by key: 0.047790050506592ms
Output for 5.0.2
in_array: 0.051243782043457ms || by key: 0.050439119338989ms
Output for 5.0.1
in_array: 0.054092884063721ms || by key: 0.051637887954712ms
Output for 5.0.0
in_array: 0.047930002212524ms || by key: 0.049240112304688ms
Output for 4.4.9
in_array: 0.060289ms || by key: 0.058899ms
Output for 4.4.8
in_array: 0.053602ms || by key: 0.054208ms
Output for 4.4.7
in_array: 0.058165ms || by key: 0.060544ms
Output for 4.4.6
in_array: 0.060964ms || by key: 0.060275ms
Output for 4.4.5
in_array: 0.053857ms || by key: -0.945586ms
Output for 4.4.4
in_array: 0.061778ms || by key: 0.065514ms
Output for 4.4.3
in_array: 0.062278ms || by key: 0.059658ms
Output for 4.4.2
in_array: 0.057769ms || by key: 0.057304ms
Output for 4.4.1
in_array: 0.066552ms || by key: 0.056121ms
Output for 4.4.0
in_array: 0.065097ms || by key: 0.061525ms
Output for 4.3.11
in_array: 0.033347ms || by key: 0.033626ms
Output for 4.3.10
in_array: -0.935478ms || by key: 0.063879ms
Output for 4.3.9
in_array: 0.064667ms || by key: 0.066915ms
Output for 4.3.8
in_array: 0.068669ms || by key: 0.069388ms
Output for 4.3.7
in_array: 0.066427ms || by key: 0.063697ms
Output for 4.3.6
in_array: 0.066186ms || by key: 0.071594ms
Output for 4.3.5
in_array: 0.062348ms || by key: 0.062361ms
Output for 4.3.4
in_array: 0.068753ms || by key: -0.929186ms
Output for 4.3.3
in_array: 0.073282ms || by key: 0.063927ms
Output for 4.3.2
in_array: 0.06512ms || by key: 0.064767ms
Output for 4.3.1
in_array: 0.061131ms || by key: 0.06149ms
Output for 4.3.0
in_array: 0.249775ms || by key: 0.077486ms