3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach: '.(microtime(true) - $t).'\n'; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo 'array_walk: '.(microtime(true) - $t).'\n'; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array, array_keys($array)); } echo 'array_map: '.(microtime(true) - $t).'\n';
Output for 7.1.0
foreach: 0.00076794624328613\narray_walk: 0.00091695785522461\narray_map: 0.00089001655578613\n
Output for 7.0.14
foreach: 0.00064802169799805\narray_walk: 0.00080513954162598\narray_map: 0.00091099739074707\n
Output for 7.0.10
foreach: 0.00047087669372559\narray_walk: 0.00055789947509766\narray_map: 0.00060105323791504\n
Output for 7.0.9
foreach: 0.00050902366638184\narray_walk: 0.00049996376037598\narray_map: 0.0005030632019043\n
Output for 7.0.8
foreach: 0.00043797492980957\narray_walk: 0.00052499771118164\narray_map: 0.00055503845214844\n
Output for 7.0.7
foreach: 0.00043487548828125\narray_walk: 0.00050711631774902\narray_map: 0.000762939453125\n
Output for 7.0.6
foreach: 0.00059294700622559\narray_walk: 0.00095701217651367\narray_map: 0.0011489391326904\n
Output for 7.0.5
foreach: 0.00050711631774902\narray_walk: 0.00085210800170898\narray_map: 0.00095796585083008\n
Output for 7.0.4
foreach: 0.00053095817565918\narray_walk: 0.00084304809570312\narray_map: 0.0010159015655518\n
Output for 7.0.3
foreach: 0.00049710273742676\narray_walk: 0.00082087516784668\narray_map: 0.0010020732879639\n
Output for 7.0.2
foreach: 0.00046300888061523\narray_walk: 0.00065517425537109\narray_map: 0.0006711483001709\n
Output for 7.0.1
foreach: 0.00060105323791504\narray_walk: 0.000885009765625\narray_map: 0.00099396705627441\n
Output for 7.0.0
foreach: 0.00061297416687012\narray_walk: 0.0010108947753906\narray_map: 0.0011270046234131\n
Output for 5.6.28
foreach: 0.0022389888763428\narray_walk: 0.0024080276489258\narray_map: 0.0037698745727539\n
Output for 5.6.25
foreach: 0.0017640590667725\narray_walk: 0.0023031234741211\narray_map: 0.0035350322723389\n
Output for 5.6.24
foreach: 0.0018401145935059\narray_walk: 0.002608060836792\narray_map: 0.0030770301818848\n
Output for 5.6.23
foreach: 0.0016040802001953\narray_walk: 0.0020990371704102\narray_map: 0.003230094909668\n
Output for 5.6.22
foreach: 0.0016939640045166\narray_walk: 0.0023188591003418\narray_map: 0.0032849311828613\n
Output for 5.6.21
foreach: 0.0014679431915283\narray_walk: 0.001910924911499\narray_map: 0.0029048919677734\n
Output for 5.6.20
foreach: 0.0016341209411621\narray_walk: 0.001978874206543\narray_map: 0.0027840137481689\n
Output for 5.6.19
foreach: 0.0015888214111328\narray_walk: 0.001967191696167\narray_map: 0.0031168460845947\n
Output for 5.6.18
foreach: 0.0013759136199951\narray_walk: 0.0015079975128174\narray_map: 0.0021867752075195\n
Output for 5.6.17
foreach: 0.0013830661773682\narray_walk: 0.0017428398132324\narray_map: 0.0038948059082031\n
Output for 5.6.16
foreach: 0.0015769004821777\narray_walk: 0.0020160675048828\narray_map: 0.0031158924102783\n
Output for 5.6.15
foreach: 0.0015909671783447\narray_walk: 0.002000093460083\narray_map: 0.0030579566955566\n
Output for 5.6.14
foreach: 0.0030691623687744\narray_walk: 0.003493070602417\narray_map: 0.0063378810882568\n
Output for 5.6.13
foreach: 0.0014288425445557\narray_walk: 0.0018420219421387\narray_map: 0.002777099609375\n
Output for 5.6.12
foreach: 0.0017471313476562\narray_walk: 0.0022189617156982\narray_map: 0.0033559799194336\n
Output for 5.6.11
foreach: 0.0018939971923828\narray_walk: 0.0022320747375488\narray_map: 0.0029811859130859\n
Output for 5.6.10
foreach: 0.0014410018920898\narray_walk: 0.0019078254699707\narray_map: 0.0029139518737793\n
Output for 5.6.9
foreach: 0.0030090808868408\narray_walk: 0.0036299228668213\narray_map: 0.0046548843383789\n
Output for 5.6.8
foreach: 0.0014960765838623\narray_walk: 0.0015161037445068\narray_map: 0.0022649765014648\n
Output for 5.6.7
foreach: 0.0020339488983154\narray_walk: 0.0024199485778809\narray_map: 0.0034561157226562\n
Output for 5.6.6
foreach: 0.0016191005706787\narray_walk: 0.0035910606384277\narray_map: 0.0042629241943359\n
Output for 5.6.5
foreach: 0.0014481544494629\narray_walk: 0.0016610622406006\narray_map: 0.002824068069458\n
Output for 5.6.4
foreach: 0.0016498565673828\narray_walk: 0.0020651817321777\narray_map: 0.0033071041107178\n
Output for 5.6.3
foreach: 0.0014901161193848\narray_walk: 0.0018529891967773\narray_map: 0.0028879642486572\n
Output for 5.6.2
foreach: 0.0015571117401123\narray_walk: 0.0018970966339111\narray_map: 0.0029900074005127\n
Output for 5.6.1
foreach: 0.0012409687042236\narray_walk: 0.0015909671783447\narray_map: 0.0025079250335693\n
Output for 5.6.0
foreach: 0.0017859935760498\narray_walk: 0.0021810531616211\narray_map: 0.0032811164855957\n
Output for 5.5.38
foreach: 0.0017299652099609\narray_walk: 0.0019268989562988\narray_map: 0.0030760765075684\n
Output for 5.5.37
foreach: 0.0018670558929443\narray_walk: 0.0019979476928711\narray_map: 0.0031521320343018\n
Output for 5.5.36
foreach: 0.0028698444366455\narray_walk: 0.0032989978790283\narray_map: 0.0048530101776123\n
Output for 5.5.35
foreach: 0.001737117767334\narray_walk: 0.0022661685943604\narray_map: 0.0034530162811279\n
Output for 5.5.34
foreach: 0.0015220642089844\narray_walk: 0.0017859935760498\narray_map: 0.0028600692749023\n
Output for 5.5.33
foreach: 0.0028259754180908\narray_walk: 0.0032129287719727\narray_map: 0.0049259662628174\n
Output for 5.5.32
foreach: 0.0016210079193115\narray_walk: 0.0018970966339111\narray_map: 0.0029900074005127\n
Output for 5.5.31
foreach: 0.0011801719665527\narray_walk: 0.0013959407806396\narray_map: 0.0021970272064209\n
Output for 5.5.30
foreach: 0.0019040107727051\narray_walk: 0.0023510456085205\narray_map: 0.0035059452056885\n
Output for 5.5.29
foreach: 0.0017249584197998\narray_walk: 0.0019969940185547\narray_map: 0.0031569004058838\n
Output for 5.5.28
foreach: 0.0016791820526123\narray_walk: 0.0017530918121338\narray_map: 0.0030179023742676\n
Output for 5.5.27
foreach: 0.0016372203826904\narray_walk: 0.0019731521606445\narray_map: 0.0030598640441895\n
Output for 5.5.26
foreach: 0.0015959739685059\narray_walk: 0.0015919208526611\narray_map: 0.0028259754180908\n
Output for 5.5.25
foreach: 0.0015270709991455\narray_walk: 0.0018110275268555\narray_map: 0.0029299259185791\n
Output for 5.5.24
foreach: 0.0018420219421387\narray_walk: 0.002208948135376\narray_map: 0.0034008026123047\n
Output for 5.5.23
foreach: 0.0020458698272705\narray_walk: 0.0022928714752197\narray_map: 0.0036230087280273\n
Output for 5.5.22
foreach: 0.0018179416656494\narray_walk: 0.0021588802337646\narray_map: 0.0035719871520996\n
Output for 5.5.21
foreach: 0.0014970302581787\narray_walk: 0.0016679763793945\narray_map: 0.0026841163635254\n
Output for 5.5.20
foreach: 0.0013408660888672\narray_walk: 0.0016648769378662\narray_map: 0.0028290748596191\n
Output for 5.5.19
foreach: 0.0014419555664062\narray_walk: 0.0017788410186768\narray_map: 0.0026741027832031\n
Output for 5.5.18
foreach: 0.001629114151001\narray_walk: 0.0019071102142334\narray_map: 0.003058910369873\n
Output for 5.5.16
foreach: 0.0017910003662109\narray_walk: 0.0021119117736816\narray_map: 0.0033669471740723\n
Output for 5.5.15
foreach: 0.0018069744110107\narray_walk: 0.002086877822876\narray_map: 0.0033221244812012\n
Output for 5.5.14
foreach: 0.0014200210571289\narray_walk: 0.0023868083953857\narray_map: 0.0029277801513672\n
Output for 5.5.13
foreach: 0.0015690326690674\narray_walk: 0.0019190311431885\narray_map: 0.0030739307403564\n
Output for 5.5.12
foreach: 0.0015950202941895\narray_walk: 0.0018179416656494\narray_map: 0.002856969833374\n
Output for 5.5.11
foreach: 0.0018250942230225\narray_walk: 0.002180814743042\narray_map: 0.0034031867980957\n
Output for 5.5.10
foreach: 0.0019030570983887\narray_walk: 0.0022978782653809\narray_map: 0.0035109519958496\n
Output for 5.5.9
foreach: 0.0019400119781494\narray_walk: 0.0022430419921875\narray_map: 0.0036530494689941\n
Output for 5.5.8
foreach: 0.001251220703125\narray_walk: 0.0014848709106445\narray_map: 0.0024220943450928\n
Output for 5.5.7
foreach: 0.0017731189727783\narray_walk: 0.0021929740905762\narray_map: 0.0034489631652832\n
Output for 5.5.6
foreach: 0.0018370151519775\narray_walk: 0.0021979808807373\narray_map: 0.0034890174865723\n
Output for 5.5.5
foreach: 0.0017969608306885\narray_walk: 0.002065896987915\narray_map: 0.00313401222229\n
Output for 5.5.4
foreach: 0.0019121170043945\narray_walk: 0.0022308826446533\narray_map: 0.0031640529632568\n
Output for 5.5.3
foreach: 0.001751184463501\narray_walk: 0.0020151138305664\narray_map: 0.0031991004943848\n
Output for 5.5.2
foreach: 0.0016391277313232\narray_walk: 0.001878023147583\narray_map: 0.0026271343231201\n
Output for 5.5.1
foreach: 0.0014288425445557\narray_walk: 0.0016849040985107\narray_map: 0.0027008056640625\n
Output for 5.5.0
foreach: 0.0023322105407715\narray_walk: 0.0013480186462402\narray_map: 0.0020871162414551\n
Output for 5.4.45
foreach: 0.0019159317016602\narray_walk: 0.0033228397369385\narray_map: 0.0027568340301514\n
Output for 5.4.44
foreach: 0.0016739368438721\narray_walk: 0.001708984375\narray_map: 0.0024559497833252\n
Output for 5.4.43
foreach: 0.0015430450439453\narray_walk: 0.0020170211791992\narray_map: 0.00307297706604\n
Output for 5.4.42
foreach: 0.0015451908111572\narray_walk: 0.0018448829650879\narray_map: 0.0028471946716309\n
Output for 5.4.41
foreach: 0.0018739700317383\narray_walk: 0.002190113067627\narray_map: 0.0033481121063232\n
Output for 5.4.40
foreach: 0.0023021697998047\narray_walk: 0.002744197845459\narray_map: 0.0042178630828857\n
Output for 5.4.39
foreach: 0.0018219947814941\narray_walk: 0.0021049976348877\narray_map: 0.0032448768615723\n
Output for 5.4.38
foreach: 0.0013518333435059\narray_walk: 0.0015590190887451\narray_map: 0.0024979114532471\n
Output for 5.4.37
foreach: 0.0018651485443115\narray_walk: 0.0022549629211426\narray_map: 0.0030410289764404\n
Output for 5.4.36
foreach: 0.0018448829650879\narray_walk: 0.0023429393768311\narray_map: 0.0035820007324219\n
Output for 5.4.35
foreach: 0.0012259483337402\narray_walk: 0.0015718936920166\narray_map: 0.0025129318237305\n
Output for 5.4.34
foreach: 0.001882791519165\narray_walk: 0.0021979808807373\narray_map: 0.003497838973999\n
Output for 5.4.32
foreach: 0.0019738674163818\narray_walk: 0.0022900104522705\narray_map: 0.0035691261291504\n
Output for 5.4.31
foreach: 0.0018939971923828\narray_walk: 0.0021860599517822\narray_map: 0.0034952163696289\n
Output for 5.4.30
foreach: 0.0014040470123291\narray_walk: 0.0017468929290771\narray_map: 0.0026578903198242\n
Output for 5.4.29
foreach: 0.0015859603881836\narray_walk: 0.0018680095672607\narray_map: 0.0029029846191406\n
Output for 5.4.28
foreach: 0.0013818740844727\narray_walk: 0.0023539066314697\narray_map: 0.0025410652160645\n
Output for 5.4.27
foreach: 0.0015270709991455\narray_walk: 0.0017991065979004\narray_map: 0.0026321411132812\n
Output for 5.4.26
foreach: 0.001507043838501\narray_walk: 0.00193190574646\narray_map: 0.0024828910827637\n
Output for 5.4.25
foreach: 0.0017769336700439\narray_walk: 0.0022621154785156\narray_map: 0.0034379959106445\n
Output for 5.4.24
foreach: 0.0019710063934326\narray_walk: 0.002284049987793\narray_map: 0.0036070346832275\n
Output for 5.4.23
foreach: 0.0018630027770996\narray_walk: 0.0022070407867432\narray_map: 0.0034840106964111\n
Output for 5.4.22
foreach: 0.0019869804382324\narray_walk: 0.0023791790008545\narray_map: 0.0036818981170654\n
Output for 5.4.21
foreach: 0.0017049312591553\narray_walk: 0.001816987991333\narray_map: 0.0023539066314697\n
Output for 5.4.20
foreach: 0.0015738010406494\narray_walk: 0.0018191337585449\narray_map: 0.0028979778289795\n
Output for 5.4.19
foreach: 0.0016500949859619\narray_walk: 0.002004861831665\narray_map: 0.0032320022583008\n
Output for 5.4.18
foreach: 0.0016980171203613\narray_walk: 0.0017211437225342\narray_map: 0.0026450157165527\n
Output for 5.4.17
foreach: 0.0016059875488281\narray_walk: 0.0019500255584717\narray_map: 0.003000020980835\n
Output for 5.4.16
foreach: 0.0015490055084229\narray_walk: 0.0018100738525391\narray_map: 0.0028259754180908\n
Output for 5.4.15
foreach: 0.0018789768218994\narray_walk: 0.0021300315856934\narray_map: 0.0033631324768066\n
Output for 5.4.14
foreach: 0.0018479824066162\narray_walk: 0.0023040771484375\narray_map: 0.0049328804016113\n
Output for 5.4.13
foreach: 0.0015361309051514\narray_walk: 0.00187087059021\narray_map: 0.0028729438781738\n
Output for 5.4.12
foreach: 0.0014278888702393\narray_walk: 0.0016510486602783\narray_map: 0.0026400089263916\n
Output for 5.4.11
foreach: 0.0011301040649414\narray_walk: 0.0013501644134521\narray_map: 0.0020678043365479\n
Output for 5.4.10
foreach: 0.0018000602722168\narray_walk: 0.002126932144165\narray_map: 0.0034830570220947\n
Output for 5.4.9
foreach: 0.0020530223846436\narray_walk: 0.0023148059844971\narray_map: 0.0035178661346436\n
Output for 5.4.8
foreach: 0.0013909339904785\narray_walk: 0.001662015914917\narray_map: 0.0026419162750244\n
Output for 5.4.7
foreach: 0.0020511150360107\narray_walk: 0.0023269653320312\narray_map: 0.003770112991333\n
Output for 5.4.6
foreach: 0.0011410713195801\narray_walk: 0.0013308525085449\narray_map: 0.0021460056304932\n
Output for 5.4.5
foreach: 0.0013659000396729\narray_walk: 0.0013859272003174\narray_map: 0.0035009384155273\n
Output for 5.4.4
foreach: 0.0014541149139404\narray_walk: 0.0015640258789062\narray_map: 0.0024139881134033\n
Output for 5.4.3
foreach: 0.0011072158813477\narray_walk: 0.001392126083374\narray_map: 0.0022048950195312\n
Output for 5.4.2
foreach: 0.001978874206543\narray_walk: 0.0024499893188477\narray_map: 0.0037639141082764\n
Output for 5.4.1
foreach: 0.0012481212615967\narray_walk: 0.0014259815216064\narray_map: 0.0024030208587646\n
Output for 5.4.0
foreach: 0.0012459754943848\narray_walk: 0.0019710063934326\narray_map: 0.0025410652160645\n
Output for 5.3.29
foreach: 0.0018908977508545\narray_walk: 0.0019228458404541\narray_map: 0.0030150413513184\n
Output for 5.3.28
foreach: 0.0016880035400391\narray_walk: 0.00189208984375\narray_map: 0.002957820892334\n
Output for 5.3.27
foreach: 0.0019612312316895\narray_walk: 0.00160813331604\narray_map: 0.0025110244750977\n
Output for 5.3.26
foreach: 0.0019650459289551\narray_walk: 0.0021181106567383\narray_map: 0.0032029151916504\n
Output for 5.3.25
foreach: 0.0015599727630615\narray_walk: 0.0016539096832275\narray_map: 0.0025629997253418\n
Output for 5.3.24
foreach: 0.0024650096893311\narray_walk: 0.0018739700317383\narray_map: 0.0029089450836182\n
Output for 5.3.23
foreach: 0.0018470287322998\narray_walk: 0.002439022064209\narray_map: 0.0034608840942383\n
Output for 5.3.22
foreach: 0.0019659996032715\narray_walk: 0.0023460388183594\narray_map: 0.0033900737762451\n
Output for 5.3.21
foreach: 0.0020821094512939\narray_walk: 0.0023031234741211\narray_map: 0.003303050994873\n
Output for 5.3.20
foreach: 0.0016181468963623\narray_walk: 0.0016758441925049\narray_map: 0.0025370121002197\n
Output for 5.3.19
foreach: 0.0020039081573486\narray_walk: 0.002324104309082\narray_map: 0.0031969547271729\n
Output for 5.3.18
foreach: 0.0020010471343994\narray_walk: 0.0017380714416504\narray_map: 0.0026638507843018\n
Output for 5.3.17
foreach: 0.001878023147583\narray_walk: 0.0022339820861816\narray_map: 0.0032150745391846\n
Output for 5.3.16
foreach: 0.0013799667358398\narray_walk: 0.0015230178833008\narray_map: 0.002194881439209\n
Output for 5.3.15
foreach: 0.0013220310211182\narray_walk: 0.0015609264373779\narray_map: 0.0022058486938477\n
Output for 5.3.14
foreach: 0.0021810531616211\narray_walk: 0.002504825592041\narray_map: 0.0036380290985107\n
Output for 5.3.13
foreach: 0.0020051002502441\narray_walk: 0.0022420883178711\narray_map: 0.0032870769500732\n
Output for 5.3.12
foreach: 0.0017080307006836\narray_walk: 0.0018830299377441\narray_map: 0.0027928352355957\n
Output for 5.3.11
foreach: 0.0016491413116455\narray_walk: 0.0017030239105225\narray_map: 0.0026569366455078\n
Output for 5.3.10
foreach: 0.0021200180053711\narray_walk: 0.0022730827331543\narray_map: 0.0032649040222168\n
Output for 5.3.9
foreach: 0.0022289752960205\narray_walk: 0.0026540756225586\narray_map: 0.0037739276885986\n
Output for 5.3.8
foreach: 0.0022029876708984\narray_walk: 0.0044269561767578\narray_map: 0.0052409172058105\n
Output for 5.3.7
foreach: 0.0021820068359375\narray_walk: 0.0024209022521973\narray_map: 0.0036680698394775\n
Output for 5.3.6
foreach: 0.0022640228271484\narray_walk: 0.0026428699493408\narray_map: 0.0037178993225098\n
Output for 5.3.5
foreach: 0.0019600391387939\narray_walk: 0.0021820068359375\narray_map: 0.0033180713653564\n
Output for 5.3.4
foreach: 0.0018799304962158\narray_walk: 0.0021679401397705\narray_map: 0.0026619434356689\n
Output for 5.3.3
foreach: 0.0019779205322266\narray_walk: 0.002194881439209\narray_map: 0.003352165222168\n
Output for 5.3.2
foreach: 0.0018270015716553\narray_walk: 0.0020959377288818\narray_map: 0.0031509399414062\n
Output for 5.3.1
foreach: 0.0020689964294434\narray_walk: 0.0019130706787109\narray_map: 0.0030181407928467\n
Output for 5.3.0
foreach: 0.0020580291748047\narray_walk: 0.0020079612731934\narray_map: 0.00301194190979\n
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/hdvDV on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/hdvDV on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/hdvDV on line 5
Process exited with code 255.