3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(0); $amount = 10000; $start = microtime(true); $alreadyOutput = array(); $iterator = $amount; while ($iterator --) { $num = rand(0, $amount); if(in_array($num, $alreadyOutput)){ continue; } $alreadyOutput[] = $num; } echo "in_array: ".(microtime(true) - $start)."ms || "; unset($alreadyOutput); $alreadyOutput = array(); $start2 = microtime(true); $iterator = $amount; while ($iterator --) { $num = rand(0, $amount); if(isset($alreadyOutput[$num])){ continue; } $alreadyOutput[$num] = true; } echo "by key: ".(microtime(true) - $start2)."ms";
based on TQDmF
Output for 7.1.0
in_array: 0.049654006958008ms || by key: 0.0014798641204834ms
Output for 7.0.14
in_array: 0.048117160797119ms || by key: 0.0013151168823242ms
Output for 7.0.7
in_array: 0.030385971069336ms || by key: 0.00089287757873535ms
Output for 7.0.6
in_array: 0.047038078308105ms || by key: 0.0011608600616455ms
Output for 7.0.5
in_array: 0.037643194198608ms || by key: 0.0010099411010742ms
Output for 7.0.4
in_array: 0.036364078521729ms || by key: 0.0010190010070801ms
Output for 7.0.3
in_array: 0.036578893661499ms || by key: 0.00091195106506348ms
Output for 7.0.2
in_array: 0.0244140625ms || by key: 0.00075078010559082ms
Output for 7.0.1
in_array: 0.034173011779785ms || by key: 0.00089001655578613ms
Output for 7.0.0
in_array: 0.030394077301025ms || by key: 0.00091886520385742ms
Output for 5.6.28
in_array: 0.46326184272766ms || by key: 0.0030148029327393ms
Output for 5.6.22
in_array: 0.36627912521362ms || by key: 0.002129077911377ms
Output for 5.6.21
in_array: 0.45128893852234ms || by key: 0.002122163772583ms
Output for 5.6.20
in_array: 0.42586994171143ms || by key: 0.0020101070404053ms
Output for 5.6.19
in_array: 0.45411801338196ms || by key: 0.0020210742950439ms
Output for 5.6.18
in_array: 0.45896100997925ms || by key: 0.0020530223846436ms
Output for 5.6.17
in_array: 0.43858003616333ms || by key: 0.0021119117736816ms
Output for 5.6.16
in_array: 0.34481906890869ms || by key: 0.001629114151001ms
Output for 5.6.15
in_array: 0.3652868270874ms || by key: 0.0017249584197998ms
Output for 5.6.14
in_array: 0.42385601997375ms || by key: 0.0027410984039307ms
Output for 5.6.13
in_array: 0.37291622161865ms || by key: 0.0016629695892334ms
Output for 5.6.12
in_array: 0.38146090507507ms || by key: 0.0016639232635498ms
Output for 5.6.11
in_array: 0.39153409004211ms || by key: 0.0016770362854004ms
Output for 5.6.10
in_array: 0.44602799415588ms || by key: 0.0020110607147217ms
Output for 5.6.9
in_array: 0.44402599334717ms || by key: 0.001986026763916ms
Output for 5.6.8
in_array: 0.44538688659668ms || by key: 0.0019950866699219ms
Output for 5.6.7
in_array: 0.44211721420288ms || by key: 0.0020298957824707ms
Output for 5.6.6
in_array: 0.3865921497345ms || by key: 0.0017499923706055ms
Output for 5.6.5
in_array: 0.44532108306885ms || by key: 0.0020370483398438ms
Output for 5.6.4
in_array: 0.46682715415955ms || by key: 0.0021750926971436ms
Output for 5.6.3
in_array: 0.45382213592529ms || by key: 0.0020859241485596ms
Output for 5.6.2
in_array: 0.45473384857178ms || by key: 0.0020241737365723ms
Output for 5.6.1
in_array: 0.45394682884216ms || by key: 0.0019989013671875ms
Output for 5.6.0
in_array: 0.43624401092529ms || by key: 0.0020279884338379ms
Output for 5.5.36
in_array: 0.36557483673096ms || by key: 0.0020809173583984ms
Output for 5.5.35
in_array: 0.44267201423645ms || by key: 0.0022189617156982ms
Output for 5.5.34
in_array: 0.45124506950378ms || by key: 0.0021059513092041ms
Output for 5.5.33
in_array: 0.44945502281189ms || by key: 0.0021219253540039ms
Output for 5.5.32
in_array: 0.44679093360901ms || by key: 0.002094030380249ms
Output for 5.5.31
in_array: 0.43807888031006ms || by key: 0.0020830631256104ms
Output for 5.5.30
in_array: 0.38566398620605ms || by key: 0.0017890930175781ms
Output for 5.5.29
in_array: 0.34825396537781ms || by key: 0.0017049312591553ms
Output for 5.5.28
in_array: 0.39106512069702ms || by key: 0.0017108917236328ms
Output for 5.5.27
in_array: 0.45015001296997ms || by key: 0.0020279884338379ms
Output for 5.5.26
in_array: 0.43724417686462ms || by key: 0.0022010803222656ms
Output for 5.5.25
in_array: 0.44974398612976ms || by key: 0.0020930767059326ms
Output for 5.5.24
in_array: 0.44937109947205ms || by key: 0.0020911693572998ms
Output for 5.5.23
in_array: 0.36888313293457ms || by key: 0.0017430782318115ms
Output for 5.5.22
in_array: 0.42188000679016ms || by key: 0.0020778179168701ms
Output for 5.5.21
in_array: 0.47651386260986ms || by key: 0.0021729469299316ms
Output for 5.5.20
in_array: 0.45002698898315ms || by key: 0.002223014831543ms
Output for 5.5.19
in_array: 0.46654486656189ms || by key: 0.0023248195648193ms
Output for 5.5.18
in_array: 0.42033791542053ms || by key: 0.0020651817321777ms
Output for 5.5.16
in_array: 0.44841694831848ms || by key: 0.0020689964294434ms
Output for 5.5.15
in_array: 0.44587111473083ms || by key: 0.0020849704742432ms
Output for 5.5.14
in_array: 0.46831798553467ms || by key: 0.0021541118621826ms
Output for 5.5.13
in_array: 0.42344999313354ms || by key: 0.0022158622741699ms
Output for 5.5.12
in_array: 0.43096709251404ms || by key: 0.0021178722381592ms
Output for 5.5.11
in_array: 0.44688606262207ms || by key: 0.002208948135376ms
Output for 5.5.10
in_array: 0.43527388572693ms || by key: 0.0021400451660156ms
Output for 5.5.9
in_array: 0.44667100906372ms || by key: 0.0020968914031982ms
Output for 5.5.8
in_array: 0.43468594551086ms || by key: 0.0021147727966309ms
Output for 5.5.7
in_array: 0.44284081459045ms || by key: 0.0020759105682373ms
Output for 5.5.6
in_array: 0.44916200637817ms || by key: 0.0023541450500488ms
Output for 5.5.5
in_array: 0.44399905204773ms || by key: 0.0020880699157715ms
Output for 5.5.4
in_array: 0.44810795783997ms || by key: 0.0021841526031494ms
Output for 5.5.3
in_array: 0.45365381240845ms || by key: 0.0020318031311035ms
Output for 5.5.2
in_array: 0.42802500724792ms || by key: 0.0022289752960205ms
Output for 5.5.1
in_array: 0.43979597091675ms || by key: 0.0021519660949707ms
Output for 5.5.0
in_array: 0.45345091819763ms || by key: 0.0020458698272705ms
Output for 5.4.45
in_array: 0.33888292312622ms || by key: 0.0017008781433105ms
Output for 5.4.44
in_array: 0.3305070400238ms || by key: 0.0016350746154785ms
Output for 5.4.43
in_array: 0.40230989456177ms || by key: 0.0019760131835938ms
Output for 5.4.42
in_array: 0.41817188262939ms || by key: 0.0019969940185547ms
Output for 5.4.41
in_array: 0.40714192390442ms || by key: 0.0020110607147217ms
Output for 5.4.40
in_array: 0.42965292930603ms || by key: 0.0020790100097656ms
Output for 5.4.39
in_array: 0.3656439781189ms || by key: 0.0016381740570068ms
Output for 5.4.38
in_array: 0.3613600730896ms || by key: 0.0016779899597168ms
Output for 5.4.37
in_array: 0.41707801818848ms || by key: 0.0019979476928711ms
Output for 5.4.36
in_array: 0.44145512580872ms || by key: 0.0022029876708984ms
Output for 5.4.35
in_array: 0.43006014823914ms || by key: 0.0020480155944824ms
Output for 5.4.34
in_array: 0.43995690345764ms || by key: 0.0020239353179932ms
Output for 5.4.32
in_array: 0.4458920955658ms || by key: 0.0020339488983154ms
Output for 5.4.31
in_array: 0.42440891265869ms || by key: 0.0020270347595215ms
Output for 5.4.30
in_array: 0.43519306182861ms || by key: 0.0019969940185547ms
Output for 5.4.29
in_array: 0.42465281486511ms || by key: 0.0020251274108887ms
Output for 5.4.28
in_array: 0.42634201049805ms || by key: 0.002126932144165ms
Output for 5.4.27
in_array: 0.42539405822754ms || by key: 0.0020220279693604ms
Output for 5.4.26
in_array: 0.43087601661682ms || by key: 0.0020508766174316ms
Output for 5.4.25
in_array: 0.44174098968506ms || by key: 0.0021650791168213ms
Output for 5.4.24
in_array: 0.43510007858276ms || by key: 0.0021259784698486ms
Output for 5.4.23
in_array: 0.43658494949341ms || by key: 0.0019619464874268ms
Output for 5.4.22
in_array: 0.43863081932068ms || by key: 0.0020089149475098ms
Output for 5.4.21
in_array: 0.43224406242371ms || by key: 0.002032995223999ms
Output for 5.4.20
in_array: 0.42772483825684ms || by key: 0.0019969940185547ms
Output for 5.4.19
in_array: 0.43263101577759ms || by key: 0.0020279884338379ms
Output for 5.4.18
in_array: 0.44705510139465ms || by key: 0.0021429061889648ms
Output for 5.4.17
in_array: 0.42750477790833ms || by key: 0.0020909309387207ms
Output for 5.4.16
in_array: 0.42946410179138ms || by key: 0.00199294090271ms
Output for 5.4.15
in_array: 0.41454601287842ms || by key: 0.0020248889923096ms
Output for 5.4.14
in_array: 0.42592597007751ms || by key: 0.0020220279693604ms
Output for 5.4.13
in_array: 0.42990517616272ms || by key: 0.0019760131835938ms
Output for 5.4.12
in_array: 0.44249606132507ms || by key: 0.0020239353179932ms
Output for 5.4.11
in_array: 0.43169093132019ms || by key: 0.0020031929016113ms
Output for 5.4.10
in_array: 0.44470906257629ms || by key: 0.0021371841430664ms
Output for 5.4.9
in_array: 0.41284799575806ms || by key: 0.0020139217376709ms
Output for 5.4.8
in_array: 0.45760893821716ms || by key: 0.0020310878753662ms
Output for 5.4.7
in_array: 0.4495210647583ms || by key: 0.0021188259124756ms
Output for 5.4.6
in_array: 0.43809103965759ms || by key: 0.0021119117736816ms
Output for 5.4.5
in_array: 0.38992500305176ms || by key: 0.0016520023345947ms
Output for 5.4.4
in_array: 0.33101010322571ms || by key: 0.0016851425170898ms
Output for 5.4.3
in_array: 0.35826897621155ms || by key: 0.0016191005706787ms
Output for 5.4.2
in_array: 0.4091911315918ms || by key: 0.0016322135925293ms
Output for 5.4.1
in_array: 0.40718793869019ms || by key: 0.0016481876373291ms
Output for 5.4.0
in_array: 0.40489196777344ms || by key: 0.0017020702362061ms
Output for 5.3.29
in_array: 0.44004201889038ms || by key: 0.0022580623626709ms
Output for 5.3.28
in_array: 0.44103503227234ms || by key: 0.0022690296173096ms
Output for 5.3.27
in_array: 0.45421195030212ms || by key: 0.0021538734436035ms
Output for 5.3.26
in_array: 0.44118404388428ms || by key: 0.0021631717681885ms
Output for 5.3.25
in_array: 0.44274997711182ms || by key: 0.0022549629211426ms
Output for 5.3.24
in_array: 0.44308495521545ms || by key: 0.0021541118621826ms
Output for 5.3.23
in_array: 0.43411111831665ms || by key: 0.0021049976348877ms
Output for 5.3.22
in_array: 0.43643498420715ms || by key: 0.0021319389343262ms
Output for 5.3.21
in_array: 0.42250299453735ms || by key: 0.0021419525146484ms
Output for 5.3.20
in_array: 0.43724894523621ms || by key: 0.0022621154785156ms
Output for 5.3.19
in_array: 0.43359899520874ms || by key: 0.0021650791168213ms
Output for 5.3.18
in_array: 0.44384503364563ms || by key: 0.0022480487823486ms
Output for 5.3.17
in_array: 0.42511391639709ms || by key: 0.0021519660949707ms
Output for 5.3.16
in_array: 0.44532299041748ms || by key: 0.002147912979126ms
Output for 5.3.15
in_array: 0.40954089164734ms || by key: 0.0021810531616211ms
Output for 5.3.14
in_array: 0.36119389533997ms || by key: 0.0017580986022949ms
Output for 5.3.13
in_array: 0.40446186065674ms || by key: 0.0021200180053711ms
Output for 5.3.12
in_array: 0.41196012496948ms || by key: 0.0017778873443604ms
Output for 5.3.11
in_array: 0.33266115188599ms || by key: 0.0017919540405273ms
Output for 5.3.10
in_array: 0.33446002006531ms || by key: 0.0017721652984619ms
Output for 5.3.9
in_array: 0.34468603134155ms || by key: 0.0018689632415771ms
Output for 5.3.8
in_array: 0.362468957901ms || by key: 0.0028650760650635ms
Output for 5.3.7
in_array: 0.35757088661194ms || by key: 0.0018510818481445ms
Output for 5.3.6
in_array: 0.3531391620636ms || by key: 0.0017468929290771ms
Output for 5.3.5
in_array: 0.42010807991028ms || by key: 0.0022351741790771ms
Output for 5.3.4
in_array: 0.4257960319519ms || by key: 0.0029430389404297ms
Output for 5.3.3
in_array: 0.4234631061554ms || by key: 0.0024960041046143ms
Output for 5.3.2
in_array: 0.43863391876221ms || by key: 0.00223708152771ms
Output for 5.3.1
in_array: 0.44523000717163ms || by key: 0.0022320747375488ms
Output for 5.3.0
in_array: 0.44947504997253ms || by key: 0.0021748542785645ms
Output for 5.2.17
in_array: 0.52147793769836ms || by key: 0.00193190574646ms
Output for 5.2.16
in_array: 0.79470205307007ms || by key: 0.0033700466156006ms
Output for 5.2.15
in_array: 0.50921106338501ms || by key: 0.0019309520721436ms
Output for 5.2.14
in_array: 0.49664115905762ms || by key: 0.0028889179229736ms
Output for 5.2.13
in_array: 0.58913683891296ms || by key: 0.002345085144043ms
Output for 5.2.12
in_array: 0.61844086647034ms || by key: 0.0023839473724365ms
Output for 5.2.11
in_array: 0.59530997276306ms || by key: 0.0023567676544189ms
Output for 5.2.10
in_array: 0.5981969833374ms || by key: 0.0025310516357422ms
Output for 5.2.9
in_array: 0.60780906677246ms || by key: 0.0024828910827637ms
Output for 5.2.8
in_array: 0.59937000274658ms || by key: 0.0024521350860596ms
Output for 5.2.7
in_array: 0.58923006057739ms || by key: 0.002373218536377ms
Output for 5.2.6
in_array: 0.59322714805603ms || by key: 0.0023739337921143ms
Output for 5.2.5
in_array: 0.58856916427612ms || by key: 0.0025720596313477ms
Output for 5.2.4
in_array: 0.5939028263092ms || by key: 0.0027050971984863ms
Output for 5.2.3
in_array: 0.56053709983826ms || by key: 0.0020561218261719ms
Output for 5.2.2
in_array: 0.61224603652954ms || by key: 0.0027880668640137ms
Output for 5.2.1
in_array: 0.56828594207764ms || by key: 0.002310037612915ms
Output for 5.2.0
in_array: 0.56061792373657ms || by key: 0.0022718906402588ms
Output for 5.1.6
in_array: 0.61274790763855ms || by key: 0.0023329257965088ms
Output for 5.1.5
in_array: 0.64291501045227ms || by key: 0.0023348331451416ms
Output for 5.1.4
in_array: 0.63888382911682ms || by key: 0.0023798942565918ms
Output for 5.1.3
in_array: 0.62590909004211ms || by key: 0.0024399757385254ms
Output for 5.1.2
in_array: 0.58995914459229ms || by key: 0.0022718906402588ms
Output for 5.1.1
in_array: 0.60989809036255ms || by key: 0.0025179386138916ms
Output for 5.1.0
in_array: 0.56686401367188ms || by key: 0.0020370483398438ms
Output for 5.0.5
in_array: 0.62494611740112ms || by key: 0.0044839382171631ms
Output for 5.0.4
in_array: 0.61030888557434ms || by key: 0.0044929981231689ms
Output for 5.0.3
in_array: 0.61535096168518ms || by key: 0.0045020580291748ms
Output for 5.0.2
in_array: 0.65649795532227ms || by key: 0.0043678283691406ms
Output for 5.0.1
in_array: 0.63042998313904ms || by key: 0.0043520927429199ms
Output for 5.0.0
in_array: 0.5986020565033ms || by key: 0.0044550895690918ms
Output for 4.4.9
in_array: -0.452758ms || by key: 0.003869ms
Output for 4.4.8
in_array: 0.595258ms || by key: 0.004459ms
Output for 4.4.7
in_array: -0.391621ms || by key: 0.004428ms
Output for 4.4.6
in_array: -0.394291ms || by key: 0.004441ms
Output for 4.4.5
in_array: 0.588986ms || by key: 0.004423ms
Output for 4.4.4
in_array: -0.492259ms || by key: 0.003561ms
Output for 4.4.3
in_array: 0.579265ms || by key: 0.004487ms
Output for 4.4.2
in_array: 0.556856ms || by key: 0.004435ms
Output for 4.4.1
in_array: 0.569551ms || by key: 0.004521ms
Output for 4.4.0
in_array: -0.438799ms || by key: 0.004574ms
Output for 4.3.11
in_array: 0.566363ms || by key: 0.004347ms
Output for 4.3.10
in_array: -0.450166ms || by key: 0.004438ms
Output for 4.3.9
in_array: 0.596943ms || by key: 0.0043260000000001ms
Output for 4.3.8
in_array: 0.567451ms || by key: 0.0044310000000001ms
Output for 4.3.7
in_array: -0.430494ms || by key: 0.004525ms
Output for 4.3.6
in_array: -0.398358ms || by key: 0.00445ms
Output for 4.3.5
in_array: 0.57044ms || by key: 0.008162ms
Output for 4.3.4
in_array: 0.561435ms || by key: 0.004305ms
Output for 4.3.3
in_array: -0.464217ms || by key: 0.004535ms
Output for 4.3.2
in_array: 0.599444ms || by key: 0.015798ms
Output for 4.3.1
in_array: 0.507302ms || by key: 0.013005ms
Output for 4.3.0
in_array: -0.506426ms || by key: 0.01299ms