3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $iter = 1000; $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.036164999008179\narray_walk: 0.047349214553833\narray_map: 0.048537015914917\n
Output for 7.0.14
foreach: 0.057255983352661\narray_walk: 0.054248094558716\narray_map: -0.0080938339233398\n
Output for 7.0.10
foreach: 0.044373035430908\narray_walk: 0.043007135391235\narray_map: 0.045900106430054\n
Output for 7.0.9
foreach: 0.036118030548096\narray_walk: 0.038064956665039\narray_map: 0.044745206832886\n
Output for 7.0.8
foreach: 0.045658111572266\narray_walk: 0.043673992156982\narray_map: 0.046303987503052\n
Output for 7.0.7
foreach: 0.032685041427612\narray_walk: 0.032081842422485\narray_map: 0.037659168243408\n
Output for 7.0.6
foreach: 0.063101053237915\narray_walk: 0.075210094451904\narray_map: 0.073837041854858\n
Output for 7.0.5
foreach: 0.050716876983643\narray_walk: 0.060782909393311\narray_map: 0.06978702545166\n
Output for 7.0.4
foreach: 0.041893005371094\narray_walk: 0.058227062225342\narray_map: 0.070141077041626\n
Output for 7.0.3
foreach: 0.040810108184814\narray_walk: 0.060239791870117\narray_map: 0.070585966110229\n
Output for 7.0.2
foreach: 0.049721002578735\narray_walk: 0.061996936798096\narray_map: 0.065983057022095\n
Output for 7.0.1
foreach: 0.039889097213745\narray_walk: 0.058610916137695\narray_map: 0.068238973617554\n
Output for 7.0.0
foreach: 0.045777082443237\narray_walk: 0.059716939926147\narray_map: 0.068427801132202\n
Output for 5.6.28
foreach: 0.16289091110229\narray_walk: 0.15978693962097\narray_map: 0.26435089111328\n
Output for 5.6.25
foreach: 0.12322306632996\narray_walk: 0.13852000236511\narray_map: 0.30776000022888\n
Output for 5.6.24
foreach: 0.10940003395081\narray_walk: 0.12642288208008\narray_map: 0.26046085357666\n
Output for 5.6.23
foreach: 0.12210488319397\narray_walk: 0.15535688400269\narray_map: 0.33835387229919\n
Output for 5.6.22
foreach: 0.092909097671509\narray_walk: 0.11527585983276\narray_map: 0.2548930644989\n
Output for 5.6.21
foreach: 0.11572289466858\narray_walk: 0.1348569393158\narray_map: 0.29880404472351\n
Output for 5.6.20
foreach: 0.12042689323425\narray_walk: 0.13492608070374\narray_map: 0.30401396751404\n
Output for 5.6.19
foreach: 0.18694305419922\narray_walk: 0.14205098152161\narray_map: 0.30015397071838\n
Output for 5.6.18
foreach: 0.13999891281128\narray_walk: 0.14123487472534\narray_map: 0.31609201431274\n
Output for 5.6.17
foreach: 0.11302495002747\narray_walk: 0.13525795936584\narray_map: 0.32449102401733\n
Output for 5.6.16
foreach: 0.1187059879303\narray_walk: 0.13765287399292\narray_map: 0.31007099151611\n
Output for 5.6.15
foreach: 0.13646602630615\narray_walk: 0.13467717170715\narray_map: 0.30113315582275\n
Output for 5.6.14
foreach: 0.12674403190613\narray_walk: 0.13626909255981\narray_map: 0.29887986183167\n
Output for 5.6.13
foreach: 0.11423897743225\narray_walk: 0.13641905784607\narray_map: 0.3101589679718\n
Output for 5.6.12
foreach: 0.11780881881714\narray_walk: 0.13712501525879\narray_map: 0.29994797706604\n
Output for 5.6.11
foreach: 0.11476182937622\narray_walk: 0.13160490989685\narray_map: 0.30283904075623\n
Output for 5.6.10
foreach: 0.11751914024353\narray_walk: 0.13251996040344\narray_map: 0.3010950088501\n
Output for 5.6.9
foreach: 0.13071012496948\narray_walk: 0.13139796257019\narray_map: 0.3223831653595\n
Output for 5.6.8
foreach: 0.14369893074036\narray_walk: 0.13780903816223\narray_map: 0.30200600624084\n
Output for 5.6.7
foreach: 0.12619304656982\narray_walk: 0.15061712265015\narray_map: 0.35179805755615\n
Output for 5.6.6
foreach: 0.11493706703186\narray_walk: 0.12805604934692\narray_map: 0.29995489120483\n
Output for 5.6.5
foreach: 0.12711596488953\narray_walk: 0.13037109375\narray_map: 0.29678082466125\n
Output for 5.6.4
foreach: 0.13894104957581\narray_walk: 0.13220000267029\narray_map: 0.29856204986572\n
Output for 5.6.3
foreach: 0.11610507965088\narray_walk: 0.13054895401001\narray_map: 0.31235504150391\n
Output for 5.6.2
foreach: 0.12373185157776\narray_walk: 0.13064002990723\narray_map: 0.29894518852234\n
Output for 5.6.1
foreach: 0.12866020202637\narray_walk: 0.13015508651733\narray_map: 0.29422616958618\n
Output for 5.6.0
foreach: 0.12137007713318\narray_walk: 0.13349294662476\narray_map: 0.29908895492554\n
Output for 5.5.38
foreach: 0.088397979736328\narray_walk: 0.10293912887573\narray_map: 0.24861097335815\n
Output for 5.5.37
foreach: 0.10798406600952\narray_walk: 0.124351978302\narray_map: 0.24962496757507\n
Output for 5.5.36
foreach: 0.1116509437561\narray_walk: 0.12504196166992\narray_map: 0.268150806427\n
Output for 5.5.35
foreach: 0.12285590171814\narray_walk: 0.14524507522583\narray_map: 0.277428150177\n
Output for 5.5.34
foreach: 0.11158299446106\narray_walk: 0.12717080116272\narray_map: 0.29651808738708\n
Output for 5.5.33
foreach: 0.19646811485291\narray_walk: 0.13655400276184\narray_map: 0.31597781181335\n
Output for 5.5.32
foreach: 0.12169694900513\narray_walk: 0.12646508216858\narray_map: 0.31377911567688\n
Output for 5.5.31
foreach: 0.13861584663391\narray_walk: 0.1339910030365\narray_map: 0.30210518836975\n
Output for 5.5.30
foreach: 0.11929297447205\narray_walk: 0.13202714920044\narray_map: 0.30025601387024\n
Output for 5.5.29
foreach: 0.12498807907104\narray_walk: 0.12942886352539\narray_map: 0.29540801048279\n
Output for 5.5.28
foreach: 0.11540985107422\narray_walk: 0.12967610359192\narray_map: 0.29557299613953\n
Output for 5.5.27
foreach: 0.12580680847168\narray_walk: 0.12630796432495\narray_map: 0.29708909988403\n
Output for 5.5.26
foreach: 0.12061190605164\narray_walk: 0.13073515892029\narray_map: 0.29599404335022\n
Output for 5.5.25
foreach: 0.11860489845276\narray_walk: 0.12930107116699\narray_map: 0.29645586013794\n
Output for 5.5.24
foreach: 0.12381291389465\narray_walk: 0.13227295875549\narray_map: 0.29701209068298\n
Output for 5.5.23
foreach: 0.12473511695862\narray_walk: 0.12586998939514\narray_map: 0.29775595664978\n
Output for 5.5.22
foreach: 0.16343307495117\narray_walk: 0.1306779384613\narray_map: 0.29438591003418\n
Output for 5.5.21
foreach: 0.111820936203\narray_walk: 0.12639403343201\narray_map: 0.29415893554688\n
Output for 5.5.20
foreach: 0.11033391952515\narray_walk: 0.1242790222168\narray_map: 0.29347705841064\n
Output for 5.5.19
foreach: 0.12001514434814\narray_walk: 0.12620711326599\narray_map: 0.2944769859314\n
Output for 5.5.18
foreach: 0.10762000083923\narray_walk: 0.12578320503235\narray_map: 0.28977298736572\n
Output for 5.5.16
foreach: 0.14115500450134\narray_walk: 0.1319739818573\narray_map: 0.31094098091125\n
Output for 5.5.15
foreach: 0.11595606803894\narray_walk: 0.12694215774536\narray_map: 0.29970192909241\n
Output for 5.5.14
foreach: 0.12633609771729\narray_walk: 0.1308650970459\narray_map: 0.3134229183197\n
Output for 5.5.13
foreach: 0.11380696296692\narray_walk: 0.13191699981689\narray_map: 0.29972791671753\n
Output for 5.5.12
foreach: 0.10814213752747\narray_walk: 0.13031387329102\narray_map: 0.25540995597839\n
Output for 5.5.11
foreach: 0.10603880882263\narray_walk: 0.13031315803528\narray_map: 0.28085780143738\n
Output for 5.5.10
foreach: 0.13153600692749\narray_walk: 0.14744591712952\narray_map: 0.29945397377014\n
Output for 5.5.9
foreach: 0.11252307891846\narray_walk: 0.127032995224\narray_map: 0.25770998001099\n
Output for 5.5.8
foreach: 0.11224007606506\narray_walk: 0.12431812286377\narray_map: 0.29414701461792\n
Output for 5.5.7
foreach: 0.10874104499817\narray_walk: 0.13063812255859\narray_map: 0.29856991767883\n
Output for 5.5.6
foreach: 0.12192511558533\narray_walk: 0.13294911384583\narray_map: 0.30618596076965\n
Output for 5.5.5
foreach: 0.11839818954468\narray_walk: 0.13125514984131\narray_map: 0.29657888412476\n
Output for 5.5.4
foreach: 0.14408302307129\narray_walk: 0.12986493110657\narray_map: 0.2938449382782\n
Output for 5.5.3
foreach: 0.15434908866882\narray_walk: 0.15381121635437\narray_map: 0.30708909034729\n
Output for 5.5.2
foreach: 0.12717604637146\narray_walk: 0.12906885147095\narray_map: 0.30330801010132\n
Output for 5.5.1
foreach: 0.1221330165863\narray_walk: 0.1321439743042\narray_map: 0.29396390914917\n
Output for 5.5.0
foreach: 0.1212420463562\narray_walk: 0.13076591491699\narray_map: 0.31660103797913\n
Output for 5.4.45
foreach: 0.13755106925964\narray_walk: 0.13041186332703\narray_map: 0.29100894927979\n
Output for 5.4.44
foreach: 0.11745190620422\narray_walk: 0.12978601455688\narray_map: 0.29116606712341\n
Output for 5.4.43
foreach: 0.18376612663269\narray_walk: 0.1347439289093\narray_map: 0.29256510734558\n
Output for 5.4.42
foreach: 0.12060904502869\narray_walk: 0.13086414337158\narray_map: 0.29270720481873\n
Output for 5.4.41
foreach: 0.1327269077301\narray_walk: 0.15459990501404\narray_map: 0.33824300765991\n
Output for 5.4.40
foreach: 0.12538003921509\narray_walk: 0.12800002098083\narray_map: 0.29413414001465\n
Output for 5.4.39
foreach: 0.18917894363403\narray_walk: 0.13845300674438\narray_map: 0.29182291030884\n
Output for 5.4.38
foreach: 0.1242299079895\narray_walk: 0.12994599342346\narray_map: 0.29469799995422\n
Output for 5.4.37
foreach: 0.13047814369202\narray_walk: 0.15023303031921\narray_map: 0.33838391304016\n
Output for 5.4.36
foreach: 0.12960600852966\narray_walk: 0.12857818603516\narray_map: 0.29254579544067\n
Output for 5.4.35
foreach: 0.12233781814575\narray_walk: 0.12955403327942\narray_map: 0.29514908790588\n
Output for 5.4.34
foreach: 0.12113285064697\narray_walk: 0.13028788566589\narray_map: 0.31187391281128\n
Output for 5.4.32
foreach: 0.12483882904053\narray_walk: 0.12851905822754\narray_map: 0.30808091163635\n
Output for 5.4.31
foreach: 0.12938189506531\narray_walk: 0.12822818756104\narray_map: 0.29003500938416\n
Output for 5.4.30
foreach: 0.14576816558838\narray_walk: 0.13453221321106\narray_map: 0.30744004249573\n
Output for 5.4.29
foreach: 0.12087917327881\narray_walk: 0.13232493400574\narray_map: 0.3099250793457\n
Output for 5.4.28
foreach: 0.11310982704163\narray_walk: 0.12877917289734\narray_map: 0.27336001396179\n
Output for 5.4.27
foreach: 0.14562582969666\narray_walk: 0.11737298965454\narray_map: 0.26250290870667\n
Output for 5.4.26
foreach: 0.13387203216553\narray_walk: 0.11538314819336\narray_map: 0.24410700798035\n
Output for 5.4.25
foreach: 0.13632607460022\narray_walk: 0.15362501144409\narray_map: 0.33438301086426\n
Output for 5.4.24
foreach: 0.11170482635498\narray_walk: 0.1287670135498\narray_map: 0.28624796867371\n
Output for 5.4.23
foreach: 0.1361129283905\narray_walk: 0.13105487823486\narray_map: 0.2942750453949\n
Output for 5.4.22
foreach: 0.11727094650269\narray_walk: 0.12918996810913\narray_map: 0.29035496711731\n
Output for 5.4.21
foreach: 0.13919591903687\narray_walk: 0.12673497200012\narray_map: 0.29179406166077\n
Output for 5.4.20
foreach: 0.15157318115234\narray_walk: 0.13130497932434\narray_map: 0.2926299571991\n
Output for 5.4.19
foreach: 0.14574885368347\narray_walk: 0.12811589241028\narray_map: 0.29200410842896\n
Output for 5.4.18
foreach: 0.11596488952637\narray_walk: 0.13029289245605\narray_map: 0.29380702972412\n
Output for 5.4.17
foreach: 0.12095212936401\narray_walk: 0.13180494308472\narray_map: 0.29521679878235\n
Output for 5.4.16
foreach: 0.13944911956787\narray_walk: 0.12947082519531\narray_map: 0.31595015525818\n
Output for 5.4.15
foreach: 0.12693405151367\narray_walk: 0.12622714042664\narray_map: 0.29492092132568\n
Output for 5.4.14
foreach: 0.14785599708557\narray_walk: 0.13248515129089\narray_map: 0.29357695579529\n
Output for 5.4.13
foreach: 0.13541698455811\narray_walk: 0.13405394554138\narray_map: 0.29387402534485\n
Output for 5.4.12
foreach: 0.12449502944946\narray_walk: 0.13572597503662\narray_map: 0.29684209823608\n
Output for 5.4.11
foreach: 0.12813901901245\narray_walk: 0.1339418888092\narray_map: 0.31220698356628\n
Output for 5.4.10
foreach: 0.14778995513916\narray_walk: 0.1314389705658\narray_map: 0.30876708030701\n
Output for 5.4.9
foreach: 0.15184998512268\narray_walk: 0.1410219669342\narray_map: 0.33350610733032\n
Output for 5.4.8
foreach: 0.18323707580566\narray_walk: 0.13718199729919\narray_map: 0.2899010181427\n
Output for 5.4.7
foreach: 0.1225950717926\narray_walk: 0.13163900375366\narray_map: 0.29499101638794\n
Output for 5.4.6
foreach: 0.12804007530212\narray_walk: 0.13655281066895\narray_map: 0.29769802093506\n
Output for 5.4.5
foreach: 0.12298822402954\narray_walk: 0.12755990028381\narray_map: 0.30271792411804\n
Output for 5.4.4
foreach: 0.13718795776367\narray_walk: 0.12825393676758\narray_map: 0.29399609565735\n
Output for 5.4.3
foreach: 0.12973189353943\narray_walk: 0.12784290313721\narray_map: 0.29341578483582\n
Output for 5.4.2
foreach: 0.15264797210693\narray_walk: 0.18430995941162\narray_map: 0.37223386764526\n
Output for 5.4.1
foreach: 0.1290500164032\narray_walk: 0.12976598739624\narray_map: 0.29457998275757\n
Output for 5.4.0
foreach: 0.13666105270386\narray_walk: 0.13367104530334\narray_map: 0.29354786872864\n
Output for 5.3.29
foreach: 0.13551497459412\narray_walk: 0.15995693206787\narray_map: 0.24615597724915\n
Output for 5.3.28
foreach: 0.14829707145691\narray_walk: 0.13420796394348\narray_map: 0.24349784851074\n
Output for 5.3.27
foreach: 0.13636898994446\narray_walk: 0.13464283943176\narray_map: 0.24428987503052\n
Output for 5.3.26
foreach: 0.13236594200134\narray_walk: 0.13707089424133\narray_map: 0.25244688987732\n
Output for 5.3.25
foreach: 0.1423671245575\narray_walk: 0.15778517723083\narray_map: 0.26937413215637\n
Output for 5.3.24
foreach: 0.14642596244812\narray_walk: 0.13348388671875\narray_map: 0.24212884902954\n
Output for 5.3.23
foreach: 0.15552401542664\narray_walk: 0.13638401031494\narray_map: 0.240877866745\n
Output for 5.3.22
foreach: 0.16633415222168\narray_walk: 0.14264702796936\narray_map: 0.25631713867188\n
Output for 5.3.21
foreach: 0.1553418636322\narray_walk: 0.14204096794128\narray_map: 0.25500011444092\n
Output for 5.3.20
foreach: 0.15127015113831\narray_walk: 0.1401309967041\narray_map: 0.25567698478699\n
Output for 5.3.19
foreach: 0.16169810295105\narray_walk: 0.13776612281799\narray_map: 0.24479484558105\n
Output for 5.3.18
foreach: 0.13288903236389\narray_walk: 0.13813805580139\narray_map: 0.24462604522705\n
Output for 5.3.17
foreach: 0.16859412193298\narray_walk: 0.14370703697205\narray_map: 0.24811196327209\n
Output for 5.3.16
foreach: 0.16509914398193\narray_walk: 0.13689303398132\narray_map: 0.23901391029358\n
Output for 5.3.15
foreach: 0.14426302909851\narray_walk: 0.14157700538635\narray_map: 0.24128890037537\n
Output for 5.3.14
foreach: 0.13920903205872\narray_walk: 0.1363160610199\narray_map: 0.24703907966614\n
Output for 5.3.13
foreach: 0.134113073349\narray_walk: 0.14458990097046\narray_map: 0.25178408622742\n
Output for 5.3.12
foreach: 0.14873909950256\narray_walk: 0.14205002784729\narray_map: 0.25058102607727\n
Output for 5.3.11
foreach: 0.16490006446838\narray_walk: 0.14212322235107\narray_map: 0.24163413047791\n
Output for 5.3.10
foreach: 0.1363480091095\narray_walk: 0.14197993278503\narray_map: 0.23455691337585\n
Output for 5.3.9
foreach: 0.13270211219788\narray_walk: 0.1416928768158\narray_map: 0.23692893981934\n
Output for 5.3.8
foreach: 0.165776014328\narray_walk: 0.14054107666016\narray_map: 0.24015998840332\n
Output for 5.3.7
foreach: 0.14459085464478\narray_walk: 0.1408679485321\narray_map: 0.2440710067749\n
Output for 5.3.6
foreach: 0.13874101638794\narray_walk: 0.14052700996399\narray_map: 0.24399089813232\n
Output for 5.3.5
foreach: 0.14970397949219\narray_walk: 0.13952684402466\narray_map: 0.24256706237793\n
Output for 5.3.4
foreach: 0.15605187416077\narray_walk: 0.13749313354492\narray_map: 0.23498702049255\n
Output for 5.3.3
foreach: 0.14372110366821\narray_walk: 0.14013814926147\narray_map: 0.23971509933472\n
Output for 5.3.2
foreach: 0.13929510116577\narray_walk: 0.14400482177734\narray_map: 0.24322009086609\n
Output for 5.3.1
foreach: 0.14536190032959\narray_walk: 0.16275191307068\narray_map: 0.26588892936707\n
Output for 5.3.0
foreach: 0.16188597679138\narray_walk: 0.14010500907898\narray_map: 0.23658680915833\n
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/D377o 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/D377o on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/D377o on line 5
Process exited with code 255.