3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(0); $start = microtime(true); for($i = 0; $i < 100000; $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 < 100000; $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.058197021484375ms || by key: 0.050078868865967ms
Output for 7.0.14
in_array: 0.058978080749512ms || by key: 0.048793077468872ms
Output for 7.0.6
in_array: 0.046953916549683ms || by key: 0.040245056152344ms
Output for 7.0.5
in_array: 0.042304992675781ms || by key: 0.036288022994995ms
Output for 7.0.4
in_array: 0.049983978271484ms || by key: 0.041870832443237ms
Output for 7.0.3
in_array: 0.040070056915283ms || by key: 0.039443969726562ms
Output for 7.0.2
in_array: 0.043040037155151ms || by key: 0.034466028213501ms
Output for 7.0.1
in_array: 0.054183959960938ms || by key: 0.044826984405518ms
Output for 7.0.0
in_array: 0.052063941955566ms || by key: 0.043673992156982ms
Output for hhvm-3.12.0
in_array: 0.011685848236084ms || by key: 0.012688875198364ms
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
in_array: 0.069318056106567ms || by key: 0.057008028030396ms
Output for 5.6.21
in_array: 0.048063993453979ms || by key: 0.041050910949707ms
Output for 5.6.20
in_array: 0.052155017852783ms || by key: 0.044219017028809ms
Output for 5.6.19
in_array: 0.040749073028564ms || by key: 0.040422916412354ms
Output for 5.6.18
in_array: 0.04780912399292ms || by key: 0.040803909301758ms
Output for 5.6.17
in_array: 0.039024829864502ms || by key: 0.038108825683594ms
Output for 5.6.16
in_array: 0.045312881469727ms || by key: 0.036417961120605ms
Output for 5.6.15
in_array: 0.051843881607056ms || by key: 0.038661956787109ms
Output for 5.6.14
in_array: 0.047358989715576ms || by key: 0.039125919342041ms
Output for 5.6.13
in_array: 0.043853998184204ms || by key: 0.039268970489502ms
Output for 5.6.12
in_array: 0.055574178695679ms || by key: 0.04377007484436ms
Output for 5.6.11
in_array: 0.05411696434021ms || by key: 0.04409384727478ms
Output for 5.6.10
in_array: 0.044264078140259ms || by key: 0.038532972335815ms
Output for 5.6.9
in_array: 0.045316934585571ms || by key: 0.042043924331665ms
Output for 5.6.8
in_array: 0.051714897155762ms || by key: 0.042820930480957ms
Output for 5.6.7
in_array: 0.036322116851807ms || by key: 0.036134958267212ms
Output for 5.5.35
in_array: 0.047543048858643ms || by key: 0.038832902908325ms
Output for 5.5.34
in_array: 0.051906108856201ms || by key: 0.044272899627686ms
Output for 5.5.33
in_array: 0.037914991378784ms || by key: 0.037677049636841ms
Output for 5.5.32
in_array: 0.04435396194458ms || by key: 0.038846015930176ms
Output for 5.5.31
in_array: 0.050338983535767ms || by key: 0.04228401184082ms
Output for 5.5.30
in_array: 0.035313129425049ms || by key: 0.035367965698242ms
Output for 5.5.29
in_array: 0.039092063903809ms || by key: 0.036739110946655ms
Output for 5.5.28
in_array: 0.055616140365601ms || by key: 0.045000791549683ms
Output for 5.5.27
in_array: 0.049049139022827ms || by key: 0.038218021392822ms
Output for 5.5.26
in_array: 0.042072057723999ms || by key: 0.037313938140869ms
Output for 5.5.25
in_array: 0.052911996841431ms || by key: 0.043636083602905ms
Output for 5.5.24
in_array: 0.041898965835571ms || by key: 0.039044857025146ms
Output for 5.4.45
in_array: 0.12414503097534ms || by key: 0.098995208740234ms
Output for 5.4.44
in_array: 0.065749883651733ms || by key: 0.035293817520142ms
Output for 5.4.43
in_array: 0.061651945114136ms || by key: 0.053313970565796ms
Output for 5.4.42
in_array: 0.034367084503174ms || by key: 0.030880928039551ms
Output for 5.4.41
in_array: 0.091320037841797ms || by key: 0.0924232006073ms
Output for 5.4.40
in_array: 0.038712024688721ms || by key: 0.031580209732056ms
Output for 5.4.39
in_array: 0.13880801200867ms || by key: 0.18004703521729ms
Output for 5.4.38
in_array: 0.09430193901062ms || by key: 0.084849834442139ms
Output for 5.4.37
in_array: 0.11994695663452ms || by key: 0.12009906768799ms
Output for 5.4.36
in_array: 0.11827397346497ms || by key: 0.064746856689453ms
Output for 5.4.35
in_array: 0.061440944671631ms || by key: 0.051861047744751ms
Output for 5.4.34
in_array: 0.12917995452881ms || by key: 0.071616172790527ms
Output for 5.4.32
in_array: 0.044168949127197ms || by key: 0.045124053955078ms
Output for 5.4.31
in_array: 0.046765089035034ms || by key: 0.046198844909668ms
Output for 5.4.30
in_array: 0.042283058166504ms || by key: 0.042220115661621ms
Output for 5.4.29
in_array: 0.047055006027222ms || by key: 0.047318935394287ms
Output for 5.4.28
in_array: 0.041380882263184ms || by key: 0.041429996490479ms
Output for 5.4.27
in_array: 0.04021692276001ms || by key: 0.041039943695068ms
Output for 5.4.26
in_array: 0.041232109069824ms || by key: 0.04135799407959ms
Output for 5.4.25
in_array: 0.040215015411377ms || by key: 0.041287899017334ms
Output for 5.4.24
in_array: 0.05079984664917ms || by key: 0.054410934448242ms
Output for 5.4.23
in_array: 0.042530059814453ms || by key: 0.042878866195679ms
Output for 5.4.22
in_array: 0.041918992996216ms || by key: 0.041815042495728ms
Output for 5.4.21
in_array: 0.040277004241943ms || by key: 0.040940999984741ms
Output for 5.4.20
in_array: 0.04203200340271ms || by key: 0.041810989379883ms
Output for 5.4.19
in_array: 0.040966987609863ms || by key: 0.041948080062866ms
Output for 5.4.18
in_array: 0.041692972183228ms || by key: 0.040414810180664ms
Output for 5.4.17
in_array: 0.055349826812744ms || by key: 0.043022155761719ms
Output for 5.4.16
in_array: 0.043749094009399ms || by key: 0.043640851974487ms
Output for 5.4.15
in_array: 0.042125940322876ms || by key: 0.041551113128662ms
Output for 5.4.14
in_array: 0.04087495803833ms || by key: 0.04072904586792ms
Output for 5.4.13
in_array: 0.039807081222534ms || by key: 0.040610074996948ms
Output for 5.4.12
in_array: 0.043980121612549ms || by key: 0.045245170593262ms
Output for 5.4.11
in_array: 0.045941829681396ms || by key: 0.047086954116821ms
Output for 5.4.10
in_array: 0.049853086471558ms || by key: 0.052222967147827ms
Output for 5.4.9
in_array: 0.04473090171814ms || by key: 0.04426097869873ms
Output for 5.4.8
in_array: 0.049721956253052ms || by key: 0.059217929840088ms
Output for 5.4.7
in_array: 0.042782068252563ms || by key: 0.042770147323608ms
Output for 5.4.6
in_array: 0.040640830993652ms || by key: 0.040892124176025ms
Output for 5.4.5
in_array: 0.042303085327148ms || by key: 0.049713850021362ms
Output for 5.4.4
in_array: 0.045995950698853ms || by key: 0.042809009552002ms
Output for 5.4.3
in_array: 0.041656970977783ms || by key: 0.061672925949097ms
Output for 5.4.2
in_array: 0.049288988113403ms || by key: 0.043345928192139ms
Output for 5.4.1
in_array: 0.043160915374756ms || by key: 0.043272018432617ms
Output for 5.4.0
in_array: 0.044265985488892ms || by key: 0.049247980117798ms
Output for 5.3.29
in_array: 0.086135149002075ms || by key: 0.074518918991089ms
Output for 5.3.28
in_array: 0.059113025665283ms || by key: 0.045806884765625ms
Output for 5.3.27
in_array: 0.057395935058594ms || by key: 0.045736074447632ms
Output for 5.3.26
in_array: 0.046816110610962ms || by key: 0.047495126724243ms
Output for 5.3.25
in_array: 0.045789957046509ms || by key: 0.05322003364563ms
Output for 5.3.24
in_array: 0.046553134918213ms || by key: 0.045808076858521ms
Output for 5.3.23
in_array: 0.049417972564697ms || by key: 0.047239065170288ms
Output for 5.3.22
in_array: 0.045129060745239ms || by key: 0.04462194442749ms
Output for 5.3.21
in_array: 0.045553207397461ms || by key: 0.045584917068481ms
Output for 5.3.20
in_array: 0.049819946289062ms || by key: 0.050075054168701ms
Output for 5.3.19
in_array: 0.044579029083252ms || by key: 0.045090913772583ms
Output for 5.3.18
in_array: 0.04413104057312ms || by key: 0.045766115188599ms
Output for 5.3.17
in_array: 0.044466972351074ms || by key: 0.044749975204468ms
Output for 5.3.16
in_array: 0.044704914093018ms || by key: 0.045802116394043ms
Output for 5.3.15
in_array: 0.046463012695312ms || by key: 0.046931028366089ms
Output for 5.3.14
in_array: 0.04883599281311ms || by key: 0.048978090286255ms
Output for 5.3.13
in_array: 0.045187950134277ms || by key: 0.045053005218506ms
Output for 5.3.12
in_array: 0.044370889663696ms || by key: 0.072785139083862ms
Output for 5.3.11
in_array: 0.047303915023804ms || by key: 0.054572105407715ms
Output for 5.3.10
in_array: 0.045593023300171ms || by key: 0.046252965927124ms
Output for 5.3.9
in_array: 0.051193952560425ms || by key: 0.067286014556885ms
Output for 5.3.8
in_array: 0.044255971908569ms || by key: 0.044113159179688ms
Output for 5.3.7
in_array: 0.043923854827881ms || by key: 0.0435631275177ms
Output for 5.3.6
in_array: 0.049125194549561ms || by key: 0.049175977706909ms
Output for 5.3.5
in_array: 0.047659158706665ms || by key: 0.050768136978149ms
Output for 5.3.4
in_array: 0.054075002670288ms || by key: 0.044968843460083ms
Output for 5.3.3
in_array: 0.051100969314575ms || by key: 0.050930976867676ms
Output for 5.3.2
in_array: 0.048113107681274ms || by key: 0.047685146331787ms
Output for 5.3.1
in_array: 0.044275999069214ms || by key: 0.043920993804932ms
Output for 5.3.0
in_array: 0.043148040771484ms || by key: 0.042760848999023ms
Output for 5.2.17
in_array: 0.053600072860718ms || by key: 0.055179119110107ms
Output for 5.2.16
in_array: 0.05173921585083ms || by key: 0.051256895065308ms
Output for 5.2.15
in_array: 0.049706935882568ms || by key: 0.059863090515137ms
Output for 5.2.14
in_array: 0.059481859207153ms || by key: 0.059427976608276ms
Output for 5.2.13
in_array: 0.047996997833252ms || by key: 0.047983884811401ms
Output for 5.2.12
in_array: 0.047734975814819ms || by key: 0.047664880752563ms
Output for 5.2.11
in_array: 0.048059940338135ms || by key: 0.04817008972168ms
Output for 5.2.10
in_array: 0.049066066741943ms || by key: 0.049467086791992ms
Output for 5.2.9
in_array: 0.063787937164307ms || by key: 0.054525136947632ms
Output for 5.2.8
in_array: 0.049379110336304ms || by key: 0.055981159210205ms
Output for 5.2.7
in_array: 0.052344799041748ms || by key: 0.046730995178223ms
Output for 5.2.6
in_array: 0.046589851379395ms || by key: 0.046367168426514ms
Output for 5.2.5
in_array: 0.048410892486572ms || by key: 0.047431945800781ms
Output for 5.2.4
in_array: 0.048756122589111ms || by key: 0.047469854354858ms
Output for 5.2.3
in_array: 0.051354885101318ms || by key: 0.048377990722656ms
Output for 5.2.2
in_array: 0.048943996429443ms || by key: 0.049608945846558ms
Output for 5.2.1
in_array: 0.048614978790283ms || by key: 0.046590089797974ms
Output for 5.2.0
in_array: 0.053898096084595ms || by key: 0.054992198944092ms
Output for 5.1.6
in_array: 0.046692132949829ms || by key: 0.046241998672485ms
Output for 5.1.5
in_array: 0.046811819076538ms || by key: 0.046023845672607ms
Output for 5.1.4
in_array: 0.045514822006226ms || by key: 0.046280145645142ms
Output for 5.1.3
in_array: 0.045944929122925ms || by key: 0.044924974441528ms
Output for 5.1.2
in_array: 0.053380012512207ms || by key: 0.053786993026733ms
Output for 5.1.1
in_array: 0.046931028366089ms || by key: 0.046619892120361ms
Output for 5.1.0
in_array: 0.055520057678223ms || by key: 0.06318187713623ms
Output for 5.0.5
in_array: 0.053551912307739ms || by key: 0.045306921005249ms
Output for 5.0.4
in_array: 0.064920902252197ms || by key: 0.049849987030029ms
Output for 5.0.3
in_array: 0.04590892791748ms || by key: 0.044955015182495ms
Output for 5.0.2
in_array: 0.052032947540283ms || by key: 0.050565958023071ms
Output for 5.0.1
in_array: 0.049254179000854ms || by key: 0.044602870941162ms
Output for 5.0.0
in_array: 0.053397178649902ms || by key: 0.086627006530762ms
Output for 4.4.9
in_array: 0.090118ms || by key: 0.096286ms
Output for 4.4.8
in_array: 0.051596ms || by key: 0.0533ms
Output for 4.4.7
in_array: 0.05664ms || by key: 0.057497ms
Output for 4.4.6
in_array: 0.057738ms || by key: 0.059266ms
Output for 4.4.5
in_array: 0.05144ms || by key: 0.051229ms
Output for 4.4.4
in_array: 0.057602ms || by key: 0.054189ms
Output for 4.4.3
in_array: -0.942051ms || by key: 0.057375ms
Output for 4.4.2
in_array: 0.053487ms || by key: 0.061364ms
Output for 4.4.1
in_array: 0.051382ms || by key: 0.051835ms
Output for 4.4.0
in_array: 0.059011ms || by key: 0.059314ms
Output for 4.3.11
in_array: 0.029822ms || by key: 0.027092ms
Output for 4.3.10
in_array: 0.056573ms || by key: 0.056587ms
Output for 4.3.9
in_array: 0.058355ms || by key: 0.058341ms
Output for 4.3.8
in_array: 0.061787ms || by key: 0.060555ms
Output for 4.3.7
in_array: 0.059628ms || by key: 0.058697ms
Output for 4.3.6
in_array: 0.060533ms || by key: 0.059499ms
Output for 4.3.5
in_array: 0.05876ms || by key: 0.059151ms
Output for 4.3.4
in_array: 0.061386ms || by key: 0.061731ms
Output for 4.3.3
in_array: 0.058004ms || by key: 0.057621ms
Output for 4.3.2
in_array: 0.057853ms || by key: 0.058024ms
Output for 4.3.1
in_array: 0.055459ms || by key: 0.054845ms
Output for 4.3.0
in_array: 0.176335ms || by key: 0.087479ms