3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(0); $amount = 1000000; $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 (isset($echoedArray[$result->date])) { continue; } echo $result->date . "<br />"; $echoedArray[$result->date] = true; } } echo "by key: ".(microtime(true) - $start2)."ms";
based on 9Wku6
Output for 7.1.0
in_array: -0.32759785652161ms || by key: -0.34604787826538ms
Output for 7.0.14
in_array: 0.42823910713196ms || by key: 0.14926385879517ms
Output for 7.0.6
in_array: 0.37535405158997ms || by key: 0.3752589225769ms
Output for 7.0.5
in_array: 0.34232497215271ms || by key: 0.34127998352051ms
Output for 7.0.4
in_array: 0.34530591964722ms || by key: 0.33767509460449ms
Output for 7.0.3
in_array: 0.33509802818298ms || by key: 0.33208012580872ms
Output for 7.0.2
in_array: 0.35764312744141ms || by key: 0.3431351184845ms
Output for 7.0.1
in_array: 0.39058804512024ms || by key: 0.37383818626404ms
Output for 7.0.0
in_array: 0.37865900993347ms || by key: 0.36386489868164ms
Output for hhvm-3.12.0
in_array: 0.096428155899048ms || by key: 0.093194961547852ms
Output for hhvm-3.10.0
in_array: 0.37594890594482ms || by key: 0.37512397766113ms
Output for 5.6.28
in_array: 0.43145394325256ms || by key: 0.36805582046509ms
Output for 5.6.21
in_array: 0.43011617660522ms || by key: 0.38173508644104ms
Output for 5.6.20
in_array: 0.39631605148315ms || by key: 0.37193393707275ms
Output for 5.6.19
in_array: 0.39723896980286ms || by key: 0.37386798858643ms
Output for 5.6.18
in_array: 0.37019491195679ms || by key: 0.37075185775757ms
Output for 5.6.17
in_array: 0.40235090255737ms || by key: 0.38305115699768ms
Output for 5.6.16
in_array: 0.37518095970154ms || by key: 0.36699795722961ms
Output for 5.6.15
in_array: 0.38564586639404ms || by key: 0.37981796264648ms
Output for 5.6.14
in_array: 0.41126489639282ms || by key: 0.40796613693237ms
Output for 5.6.13
in_array: 0.40121507644653ms || by key: 0.37937903404236ms
Output for 5.6.12
in_array: 0.40014100074768ms || by key: 0.38337397575378ms
Output for 5.6.11
in_array: 0.38193392753601ms || by key: 0.36650109291077ms
Output for 5.6.10
in_array: 0.37381792068481ms || by key: 0.36206603050232ms
Output for 5.6.9
in_array: 0.3696300983429ms || by key: 0.36919784545898ms
Output for 5.6.8
in_array: 0.4065101146698ms || by key: 0.3864951133728ms
Output for 5.5.35
in_array: 0.3642590045929ms || by key: 0.57932305335999ms
Output for 5.5.34
in_array: 0.38837385177612ms || by key: 0.40104699134827ms
Output for 5.5.33
in_array: 0.38000106811523ms || by key: 0.37162899971008ms
Output for 5.5.32
in_array: 0.37368607521057ms || by key: 0.36752700805664ms
Output for 5.5.31
in_array: 0.35732316970825ms || by key: 0.35821986198425ms
Output for 5.5.30
in_array: 0.38948607444763ms || by key: 0.36944198608398ms
Output for 5.5.29
in_array: 0.37580895423889ms || by key: 0.36806297302246ms
Output for 5.5.28
in_array: 0.37521195411682ms || by key: 0.36253094673157ms
Output for 5.5.27
in_array: 0.4201021194458ms || by key: 0.41536688804626ms
Output for 5.5.26
in_array: 0.3777220249176ms || by key: 0.36180090904236ms
Output for 5.5.25
in_array: 0.3590190410614ms || by key: 0.35850310325623ms
Output for 5.5.24
in_array: 0.38765811920166ms || by key: 0.37242889404297ms
Output for 5.4.45
in_array: 0.55437088012695ms || by key: 0.69808387756348ms
Output for 5.4.44
in_array: 0.52970194816589ms || by key: 1.1348288059235ms
Output for 5.4.43
in_array: 1.0891489982605ms || by key: 0.89310312271118ms
Output for 5.4.42
in_array: 0.92574906349182ms || by key: 1.3677539825439ms
Output for 5.4.41
in_array: 1.0353980064392ms || by key: 1.2195999622345ms
Output for 5.4.40
in_array: 0.98866510391235ms || by key: 0.51805806159973ms
Output for 5.4.39
in_array: 1.2557621002197ms || by key: 0.54320502281189ms
Output for 5.4.38
in_array: 0.59524393081665ms || by key: 0.6706919670105ms
Output for 5.4.37
in_array: 0.71843600273132ms || by key: 0.82534408569336ms
Output for 5.4.36
in_array: 0.62493300437927ms || by key: 0.78870487213135ms
Output for 5.4.35
in_array: 0.6278932094574ms || by key: 0.87745714187622ms
Output for 5.4.34
in_array: 0.80413198471069ms || by key: 0.8847188949585ms
Output for 5.4.32
in_array: 0.47346496582031ms || by key: 0.52121591567993ms
Output for 5.4.31
in_array: 0.46662902832031ms || by key: 0.47619986534119ms
Output for 5.4.30
in_array: 0.43536710739136ms || by key: 0.44467616081238ms
Output for 5.4.29
in_array: 0.45474600791931ms || by key: 0.46855998039246ms
Output for 5.4.28
in_array: 0.42090606689453ms || by key: 0.44403600692749ms
Output for 5.4.27
in_array: 0.42687702178955ms || by key: 0.42811322212219ms
Output for 5.4.26
in_array: 0.41804003715515ms || by key: 0.43159484863281ms
Output for 5.4.25
in_array: 0.4210250377655ms || by key: 0.43847799301147ms
Output for 5.4.24
in_array: 0.47051095962524ms || by key: 0.46589183807373ms
Output for 5.4.23
in_array: 0.42087292671204ms || by key: 0.43197798728943ms
Output for 5.4.22
in_array: 0.41800904273987ms || by key: 0.48383498191833ms
Output for 5.4.21
in_array: 0.46867394447327ms || by key: 0.46975183486938ms
Output for 5.4.20
in_array: 0.43433809280396ms || by key: 0.41971898078918ms
Output for 5.4.19
in_array: 0.444256067276ms || by key: 0.44733095169067ms
Output for 5.4.18
in_array: 0.44163608551025ms || by key: 0.43254804611206ms
Output for 5.4.17
in_array: 0.4420690536499ms || by key: 0.46334290504456ms
Output for 5.4.16
in_array: 0.4147310256958ms || by key: 0.41505289077759ms
Output for 5.4.15
in_array: 0.41976308822632ms || by key: 0.44256687164307ms
Output for 5.4.14
in_array: 0.4112548828125ms || by key: 0.42658495903015ms
Output for 5.4.13
in_array: 0.40883994102478ms || by key: 0.42439484596252ms
Output for 5.4.12
in_array: 0.45373296737671ms || by key: 0.45555305480957ms
Output for 5.4.11
in_array: 0.44746398925781ms || by key: 0.44169616699219ms
Output for 5.4.10
in_array: 0.48807501792908ms || by key: 0.47105097770691ms
Output for 5.4.9
in_array: 0.45029997825623ms || by key: 0.43830704689026ms
Output for 5.4.8
in_array: 0.44582605361938ms || by key: 0.42648911476135ms
Output for 5.4.7
in_array: 0.44534182548523ms || by key: 0.42763996124268ms
Output for 5.4.6
in_array: 0.43276882171631ms || by key: 0.41652894020081ms
Output for 5.4.5
in_array: 0.43027520179749ms || by key: 0.42972493171692ms
Output for 5.4.4
in_array: 0.48387408256531ms || by key: 0.48812007904053ms
Output for 5.4.3
in_array: 0.48126697540283ms || by key: 0.47512412071228ms
Output for 5.4.2
in_array: 0.45678186416626ms || by key: 0.41917681694031ms
Output for 5.4.1
in_array: 0.43949103355408ms || by key: 0.4187068939209ms
Output for 5.4.0
in_array: 0.43290114402771ms || by key: 0.45019197463989ms
Output for 5.3.29
in_array: 0.48374199867249ms || by key: 0.49356913566589ms
Output for 5.3.28
in_array: 0.44246506690979ms || by key: 0.44860601425171ms
Output for 5.3.27
in_array: 0.44793605804443ms || by key: 0.48533606529236ms
Output for 5.3.26
in_array: 0.45587182044983ms || by key: 0.47416019439697ms
Output for 5.3.25
in_array: 0.46985697746277ms || by key: 0.49217391014099ms
Output for 5.3.24
in_array: 0.5155200958252ms || by key: 0.51777982711792ms
Output for 5.3.23
in_array: 0.45358514785767ms || by key: 0.43695187568665ms
Output for 5.3.22
in_array: 0.47962713241577ms || by key: 0.45145893096924ms
Output for 5.3.21
in_array: 0.51106309890747ms || by key: 0.49190998077393ms
Output for 5.3.20
in_array: 0.54478287696838ms || by key: 0.53959488868713ms
Output for 5.3.19
in_array: 0.4943962097168ms || by key: 0.48925614356995ms
Output for 5.3.18
in_array: 0.46947312355042ms || by key: 0.44267201423645ms
Output for 5.3.17
in_array: 0.4508957862854ms || by key: 0.46669483184814ms
Output for 5.3.16
in_array: 0.49997806549072ms || by key: 0.4904158115387ms
Output for 5.3.15
in_array: 0.45609498023987ms || by key: 0.46809506416321ms
Output for 5.3.14
in_array: 0.46557092666626ms || by key: 0.4937481880188ms
Output for 5.3.13
in_array: 0.46123504638672ms || by key: 0.48213911056519ms
Output for 5.3.12
in_array: 0.47319602966309ms || by key: 0.47228193283081ms
Output for 5.3.11
in_array: 0.59729194641113ms || by key: 0.45760893821716ms
Output for 5.3.10
in_array: 0.50077795982361ms || by key: 0.49369382858276ms
Output for 5.3.9
in_array: 0.52512502670288ms || by key: 0.52031087875366ms
Output for 5.3.8
in_array: 0.443195104599ms || by key: 0.44238209724426ms
Output for 5.3.7
in_array: 0.45261883735657ms || by key: 0.43283915519714ms
Output for 5.3.6
in_array: 0.45851302146912ms || by key: 0.46268510818481ms
Output for 5.3.5
in_array: 0.48952603340149ms || by key: 0.47536492347717ms
Output for 5.3.4
in_array: 0.47686195373535ms || by key: 0.44911408424377ms
Output for 5.3.3
in_array: 0.51400303840637ms || by key: 0.50782012939453ms
Output for 5.3.2
in_array: 0.46193909645081ms || by key: 0.43923997879028ms
Output for 5.3.1
in_array: 0.56099820137024ms || by key: 0.45127201080322ms
Output for 5.3.0
in_array: 0.4683210849762ms || by key: 0.51923203468323ms
Output for 5.2.17
in_array: 0.5335419178009ms || by key: 0.53159189224243ms
Output for 5.2.16
in_array: 0.52985191345215ms || by key: 0.53203392028809ms
Output for 5.2.15
in_array: 0.7254159450531ms || by key: 0.49823212623596ms
Output for 5.2.14
in_array: 0.56202578544617ms || by key: 0.61961793899536ms
Output for 5.2.13
in_array: 0.46683311462402ms || by key: 0.49682593345642ms
Output for 5.2.12
in_array: 0.47738718986511ms || by key: 0.52534317970276ms
Output for 5.2.11
in_array: 0.54075288772583ms || by key: 0.53188991546631ms
Output for 5.2.10
in_array: 0.47928380966187ms || by key: 0.48070096969604ms
Output for 5.2.9
in_array: 0.63101100921631ms || by key: 0.53369092941284ms
Output for 5.2.8
in_array: 0.52346706390381ms || by key: 0.46885895729065ms
Output for 5.2.7
in_array: 0.48045897483826ms || by key: 0.46918296813965ms
Output for 5.2.6
in_array: 0.53869605064392ms || by key: 0.5163459777832ms
Output for 5.2.5
in_array: 0.48765897750854ms || by key: 0.46934604644775ms
Output for 5.2.4
in_array: 0.49095010757446ms || by key: 0.50617790222168ms
Output for 5.2.3
in_array: 0.46223306655884ms || by key: 0.45857691764832ms
Output for 5.2.2
in_array: 0.47959399223328ms || by key: 0.47788596153259ms
Output for 5.2.1
in_array: 0.47305488586426ms || by key: 0.45548582077026ms
Output for 5.2.0
in_array: 0.48190402984619ms || by key: 0.46391701698303ms
Output for 5.1.6
in_array: 0.45776104927063ms || by key: 0.47827100753784ms
Output for 5.1.5
in_array: 0.46321296691895ms || by key: 0.46067190170288ms
Output for 5.1.4
in_array: 0.47723293304443ms || by key: 0.48929905891418ms
Output for 5.1.3
in_array: 0.54667592048645ms || by key: 0.57339191436768ms
Output for 5.1.2
in_array: 0.59617209434509ms || by key: 0.58416104316711ms
Output for 5.1.1
in_array: 0.55634307861328ms || by key: 0.53339791297913ms
Output for 5.1.0
in_array: 0.53826379776001ms || by key: 0.53804612159729ms
Output for 5.0.5
in_array: 0.58543515205383ms || by key: 0.57056903839111ms
Output for 5.0.4
in_array: 0.57840299606323ms || by key: 0.53021907806396ms
Output for 5.0.3
in_array: 0.51521897315979ms || by key: 0.49655795097351ms
Output for 5.0.2
in_array: 0.51373696327209ms || by key: 0.49823403358459ms
Output for 5.0.1
in_array: 0.53007292747498ms || by key: 0.50236105918884ms
Output for 5.0.0
in_array: 0.51218295097351ms || by key: 0.50364780426025ms
Output for 4.4.9
in_array: 0.617035ms || by key: -0.308392ms
Output for 4.4.8
in_array: 0.615408ms || by key: -0.444544ms
Output for 4.4.7
in_array: -0.416445ms || by key: 0.593037ms
Output for 4.4.6
in_array: -0.363294ms || by key: -0.393576ms
Output for 4.4.5
in_array: 0.557046ms || by key: -0.445726ms
Output for 4.4.4
in_array: 0.597551ms || by key: -0.411646ms
Output for 4.4.3
in_array: -0.353236ms || by key: 0.604206ms
Output for 4.4.2
in_array: -0.417106ms || by key: 0.590634ms
Output for 4.4.1
in_array: -0.43514ms || by key: -0.418313ms
Output for 4.4.0
in_array: 0.641251ms || by key: -0.369992ms
Output for 4.3.11
in_array: 0.337492ms || by key: -0.666973ms
Output for 4.3.10
in_array: 0.633424ms || by key: -0.328613ms
Output for 4.3.9
in_array: -0.347737ms || by key: 0.647855ms
Output for 4.3.8
in_array: -0.311319ms || by key: -0.308391ms
Output for 4.3.7
in_array: 0.673738ms || by key: -0.346414ms
Output for 4.3.6
in_array: -0.330434ms || by key: 0.66587ms
Output for 4.3.5
in_array: -0.378603ms || by key: -0.368175ms
Output for 4.3.4
in_array: 0.689025ms || by key: -0.292581ms
Output for 4.3.3
in_array: -0.340845ms || by key: 0.649243ms
Output for 4.3.2
in_array: -0.34297ms || by key: -0.351781ms
Output for 4.3.1
in_array: 0.627853ms || by key: -0.356823ms
Output for 4.3.0
in_array: -0.299809ms ||
Process exited with code 137.