3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function lap($func) { $t0 = microtime(1); $numbers = range(0, 10000); $ret = $func($numbers); $t1 = microtime(1); return array($t1 - $t0, $ret); } function useArray($numbers) { $result = array(); foreach ($numbers as $number) { $result[] = $number * 10; } return $result; } function useMapClosure($numbers) { return array_map(function($number) { return $number * 10; }, $numbers); } function _tenTimes($number) { return $number * 10; } function useMapNamed($numbers) { return array_map('_tenTimes', $numbers); } foreach (array('Array', 'MapClosure', 'MapNamed') as $callback) { list($delay,) = lap("use$callback"); echo "$callback: $delay\n"; }
based on GNSiO
Output for 7.1.0
Array: 0.00039005279541016 MapClosure: 0.00069212913513184 MapNamed: 0.00064611434936523
Output for 7.0.14
Array: 0.00044107437133789 MapClosure: 0.00077390670776367 MapNamed: 0.0006721019744873
Output for 7.0.8
Array: 0.00055193901062012 MapClosure: 0.00056290626525879 MapNamed: 0.00051093101501465
Output for 7.0.7
Array: 0.00058889389038086 MapClosure: 0.00056815147399902 MapNamed: 0.00059914588928223
Output for 7.0.6
Array: 0.00053501129150391 MapClosure: 0.0008690357208252 MapNamed: 0.00056290626525879
Output for 7.0.5
Array: 0.00068187713623047 MapClosure: 0.0010478496551514 MapNamed: 0.00068807601928711
Output for 7.0.4
Array: 0.00047802925109863 MapClosure: 0.00095486640930176 MapNamed: 0.00060701370239258
Output for 7.0.3
Array: 0.00039005279541016 MapClosure: 0.0007929801940918 MapNamed: 0.00048685073852539
Output for 7.0.2
Array: 0.00037503242492676 MapClosure: 0.0012679100036621 MapNamed: 0.00075507164001465
Output for 7.0.1
Array: 0.00055408477783203 MapClosure: 0.0017030239105225 MapNamed: 0.0010061264038086
Output for 7.0.0
Array: 0.00041699409484863 MapClosure: 0.00089287757873535 MapNamed: 0.00055909156799316
Output for 5.6.28
Array: 0.0046558380126953 MapClosure: 0.0054290294647217 MapNamed: 0.0051989555358887
Output for 5.6.23
Array: 0.0053219795227051 MapClosure: 0.0055458545684814 MapNamed: 0.0056250095367432
Output for 5.6.22
Array: 0.0051450729370117 MapClosure: 0.005357027053833 MapNamed: 0.0051820278167725
Output for 5.6.21
Array: 0.0044529438018799 MapClosure: 0.0044150352478027 MapNamed: 0.0046489238739014
Output for 5.6.20
Array: 0.0044169425964355 MapClosure: 0.0036370754241943 MapNamed: 0.0035400390625
Output for 5.6.19
Array: 0.00490403175354 MapClosure: 0.005073070526123 MapNamed: 0.0050899982452393
Output for 5.6.18
Array: 0.0049910545349121 MapClosure: 0.0050318241119385 MapNamed: 0.0050349235534668
Output for 5.6.17
Array: 0.0050830841064453 MapClosure: 0.0052077770233154 MapNamed: 0.0054318904876709
Output for 5.6.16
Array: 0.0051441192626953 MapClosure: 0.004551887512207 MapNamed: 0.0042219161987305
Output for 5.6.15
Array: 0.0047659873962402 MapClosure: 0.0048589706420898 MapNamed: 0.0045750141143799
Output for 5.6.14
Array: 0.0045909881591797 MapClosure: 0.0037808418273926 MapNamed: 0.003817081451416
Output for 5.6.13
Array: 0.0045959949493408 MapClosure: 0.0045740604400635 MapNamed: 0.0047941207885742
Output for 5.6.12
Array: 0.0039160251617432 MapClosure: 0.0040321350097656 MapNamed: 0.0038590431213379
Output for 5.6.11
Array: 0.0044569969177246 MapClosure: 0.0038900375366211 MapNamed: 0.0040860176086426
Output for 5.6.10
Array: 0.0041470527648926 MapClosure: 0.0043718814849854 MapNamed: 0.0043940544128418
Output for 5.6.9
Array: 0.005173921585083 MapClosure: 0.0040149688720703 MapNamed: 0.003931999206543
Output for 5.6.8
Array: 0.0048069953918457 MapClosure: 0.005075216293335 MapNamed: 0.0052559375762939
Output for 5.6.7
Array: 0.0048720836639404 MapClosure: 0.0050489902496338 MapNamed: 0.0048539638519287
Output for 5.6.6
Array: 0.0044939517974854 MapClosure: 0.0043668746948242 MapNamed: 0.0044150352478027
Output for 5.6.5
Array: 0.0049200057983398 MapClosure: 0.0045619010925293 MapNamed: 0.0045311450958252
Output for 5.6.4
Array: 0.0044829845428467 MapClosure: 0.0044128894805908 MapNamed: 0.0039651393890381
Output for 5.6.3
Array: 0.0052919387817383 MapClosure: 0.0050981044769287 MapNamed: 0.0049259662628174
Output for 5.6.2
Array: 0.0049149990081787 MapClosure: 0.0051748752593994 MapNamed: 0.0051200389862061
Output for 5.6.1
Array: 0.0047390460968018 MapClosure: 0.0049030780792236 MapNamed: 0.0051829814910889
Output for 5.6.0
Array: 0.004237174987793 MapClosure: 0.004429817199707 MapNamed: 0.0043680667877197
Output for 5.5.37
Array: 0.0035989284515381 MapClosure: 0.0036129951477051 MapNamed: 0.0037059783935547
Output for 5.5.36
Array: 0.0042848587036133 MapClosure: 0.0043971538543701 MapNamed: 0.0040619373321533
Output for 5.5.35
Array: 0.0038201808929443 MapClosure: 0.0040321350097656 MapNamed: 0.0040299892425537
Output for 5.5.34
Array: 0.0042519569396973 MapClosure: 0.0043411254882812 MapNamed: 0.0045509338378906
Output for 5.5.33
Array: 0.0044829845428467 MapClosure: 0.0048649311065674 MapNamed: 0.0047199726104736
Output for 5.5.32
Array: 0.0044100284576416 MapClosure: 0.0044260025024414 MapNamed: 0.0046570301055908
Output for 5.5.31
Array: 0.0043671131134033 MapClosure: 0.0045731067657471 MapNamed: 0.0044848918914795
Output for 5.5.30
Array: 0.0043838024139404 MapClosure: 0.0044021606445312 MapNamed: 0.0047569274902344
Output for 5.5.29
Array: 0.00472092628479 MapClosure: 0.0048518180847168 MapNamed: 0.0051760673522949
Output for 5.5.28
Array: 0.0043730735778809 MapClosure: 0.004331111907959 MapNamed: 0.0040450096130371
Output for 5.5.27
Array: 0.0050721168518066 MapClosure: 0.0052330493927002 MapNamed: 0.0053482055664062
Output for 5.5.26
Array: 0.0034840106964111 MapClosure: 0.0034902095794678 MapNamed: 0.0037350654602051
Output for 5.5.25
Array: 0.0036110877990723 MapClosure: 0.0032942295074463 MapNamed: 0.0033459663391113
Output for 5.5.24
Array: 0.0052359104156494 MapClosure: 0.005141019821167 MapNamed: 0.0055689811706543
Output for 5.5.23
Array: 0.0046579837799072 MapClosure: 0.0048770904541016 MapNamed: 0.0035572052001953
Output for 5.5.22
Array: 0.0041141510009766 MapClosure: 0.0040590763092041 MapNamed: 0.0042200088500977
Output for 5.5.21
Array: 0.0038199424743652 MapClosure: 0.0052909851074219 MapNamed: 0.00730299949646
Output for 5.5.20
Array: 0.0043001174926758 MapClosure: 0.0038330554962158 MapNamed: 0.0035648345947266
Output for 5.5.19
Array: 0.0050480365753174 MapClosure: 0.0050048828125 MapNamed: 0.0051939487457275
Output for 5.5.18
Array: 0.0038859844207764 MapClosure: 0.0040309429168701 MapNamed: 0.0040547847747803
Output for 5.5.16
Array: 0.0053739547729492 MapClosure: 0.0053050518035889 MapNamed: 0.0054721832275391
Output for 5.5.15
Array: 0.0038449764251709 MapClosure: 0.0040290355682373 MapNamed: 0.0041470527648926
Output for 5.5.14
Array: 0.0032570362091064 MapClosure: 0.0034310817718506 MapNamed: 0.003460168838501
Output for 5.5.13
Array: 0.0038259029388428 MapClosure: 0.0036990642547607 MapNamed: 0.0039980411529541
Output for 5.5.12
Array: 0.0042288303375244 MapClosure: 0.0044529438018799 MapNamed: 0.0039310455322266
Output for 5.5.11
Array: 0.0036060810089111 MapClosure: 0.0035591125488281 MapNamed: 0.0036609172821045
Output for 5.5.10
Array: 0.002953052520752 MapClosure: 0.0032129287719727 MapNamed: 0.0033378601074219
Output for 5.5.9
Array: 0.0029480457305908 MapClosure: 0.0033199787139893 MapNamed: 0.0033349990844727
Output for 5.5.8
Array: 0.0029478073120117 MapClosure: 0.0031208992004395 MapNamed: 0.0033090114593506
Output for 5.5.7
Array: 0.0031940937042236 MapClosure: 0.0035209655761719 MapNamed: 0.0035161972045898
Output for 5.5.6
Array: 0.0030829906463623 MapClosure: 0.0032620429992676 MapNamed: 0.0033621788024902
Output for 5.5.5
Array: 0.0024878978729248 MapClosure: 0.0025110244750977 MapNamed: 0.0026030540466309
Output for 5.5.4
Array: 0.0039288997650146 MapClosure: 0.0041460990905762 MapNamed: 0.0041069984436035
Output for 5.5.3
Array: 0.0029139518737793 MapClosure: 0.0031530857086182 MapNamed: 0.0033018589019775
Output for 5.5.2
Array: 0.0028970241546631 MapClosure: 0.0030441284179688 MapNamed: 0.0031530857086182
Output for 5.5.1
Array: 0.002910852432251 MapClosure: 0.002971887588501 MapNamed: 0.0031890869140625
Output for 5.5.0
Array: 0.002924919128418 MapClosure: 0.003709077835083 MapNamed: 0.0034389495849609
Output for 5.4.45
Array: 0.0048120021820068 MapClosure: 0.0049190521240234 MapNamed: 0.005486011505127
Output for 5.4.44
Array: 0.0053129196166992 MapClosure: 0.004539966583252 MapNamed: 0.0043051242828369
Output for 5.4.43
Array: 0.0048580169677734 MapClosure: 0.0049569606781006 MapNamed: 0.0053188800811768
Output for 5.4.42
Array: 0.0043880939483643 MapClosure: 0.0045671463012695 MapNamed: 0.0049409866333008
Output for 5.4.41
Array: 0.003324031829834 MapClosure: 0.0032260417938232 MapNamed: 0.0034689903259277
Output for 5.4.40
Array: 0.0049440860748291 MapClosure: 0.0051112174987793 MapNamed: 0.0052869319915771
Output for 5.4.39
Array: 0.0032179355621338 MapClosure: 0.0031218528747559 MapNamed: 0.0032510757446289
Output for 5.4.38
Array: 0.0050880908966064 MapClosure: 0.0046069622039795 MapNamed: 0.0044510364532471
Output for 5.4.37
Array: 0.0054349899291992 MapClosure: 0.0054869651794434 MapNamed: 0.0057070255279541
Output for 5.4.36
Array: 0.0046210289001465 MapClosure: 0.004688024520874 MapNamed: 0.004951000213623
Output for 5.4.35
Array: 0.0058889389038086 MapClosure: 0.0051870346069336 MapNamed: 0.0053000450134277
Output for 5.4.34
Array: 0.004478931427002 MapClosure: 0.0047550201416016 MapNamed: 0.0045089721679688
Output for 5.4.32
Array: 0.0053248405456543 MapClosure: 0.0054559707641602 MapNamed: 0.004810094833374
Output for 5.4.31
Array: 0.0042939186096191 MapClosure: 0.0045850276947021 MapNamed: 0.0045640468597412
Output for 5.4.30
Array: 0.0032949447631836 MapClosure: 0.0033698081970215 MapNamed: 0.0035691261291504
Output for 5.4.29
Array: 0.0032649040222168 MapClosure: 0.0034279823303223 MapNamed: 0.0035920143127441
Output for 5.4.28
Array: 0.0032360553741455 MapClosure: 0.0033869743347168 MapNamed: 0.00357985496521
Output for 5.4.27
Array: 0.0030539035797119 MapClosure: 0.0031020641326904 MapNamed: 0.0033788681030273
Output for 5.4.26
Array: 0.0038890838623047 MapClosure: 0.0043148994445801 MapNamed: 0.0044739246368408
Output for 5.4.25
Array: 0.0030479431152344 MapClosure: 0.0033760070800781 MapNamed: 0.0033140182495117
Output for 5.4.24
Array: 0.0030350685119629 MapClosure: 0.0032248497009277 MapNamed: 0.0034170150756836
Output for 5.4.23
Array: 0.0031330585479736 MapClosure: 0.0034270286560059 MapNamed: 0.0036330223083496
Output for 5.4.22
Array: 0.0030319690704346 MapClosure: 0.0032479763031006 MapNamed: 0.0034258365631104
Output for 5.4.21
Array: 0.003014087677002 MapClosure: 0.0030419826507568 MapNamed: 0.0031881332397461
Output for 5.4.20
Array: 0.0027508735656738 MapClosure: 0.0028250217437744 MapNamed: 0.0029590129852295
Output for 5.4.19
Array: 0.0028729438781738 MapClosure: 0.0030100345611572 MapNamed: 0.0032460689544678
Output for 5.4.18
Array: 0.0024650096893311 MapClosure: 0.0024840831756592 MapNamed: 0.0027809143066406
Output for 5.4.17
Array: 0.0034058094024658 MapClosure: 0.0034000873565674 MapNamed: 0.0035479068756104
Output for 5.4.16
Array: 0.0028941631317139 MapClosure: 0.0030629634857178 MapNamed: 0.0034589767456055
Output for 5.4.15
Array: 0.0028829574584961 MapClosure: 0.003014087677002 MapNamed: 0.003464937210083
Output for 5.4.14
Array: 0.0028791427612305 MapClosure: 0.0030272006988525 MapNamed: 0.0032219886779785
Output for 5.4.13
Array: 0.0045528411865234 MapClosure: 0.0049030780792236 MapNamed: 0.0050761699676514
Output for 5.4.12
Array: 0.0030288696289062 MapClosure: 0.0031769275665283 MapNamed: 0.0033950805664062
Output for 5.4.11
Array: 0.0029330253601074 MapClosure: 0.0029098987579346 MapNamed: 0.0032131671905518
Output for 5.4.10
Array: 0.0028679370880127 MapClosure: 0.0037641525268555 MapNamed: 0.0037131309509277
Output for 5.4.9
Array: 0.0030379295349121 MapClosure: 0.0031659603118896 MapNamed: 0.0033440589904785
Output for 5.4.8
Array: 0.0035159587860107 MapClosure: 0.003619909286499 MapNamed: 0.0036261081695557
Output for 5.4.7
Array: 0.0030891895294189 MapClosure: 0.0032520294189453 MapNamed: 0.0033659934997559
Output for 5.4.6
Array: 0.0030159950256348 MapClosure: 0.0033080577850342 MapNamed: 0.0031609535217285
Output for 5.4.5
Array: 0.0050740242004395 MapClosure: 0.0041859149932861 MapNamed: 0.0043168067932129
Output for 5.4.4
Array: 0.004518985748291 MapClosure: 0.004425048828125 MapNamed: 0.0044529438018799
Output for 5.4.3
Array: 0.0047769546508789 MapClosure: 0.0045349597930908 MapNamed: 0.0047371387481689
Output for 5.4.2
Array: 0.0055139064788818 MapClosure: 0.0049760341644287 MapNamed: 0.0054161548614502
Output for 5.4.1
Array: 0.0036971569061279 MapClosure: 0.0042309761047363 MapNamed: 0.0037531852722168
Output for 5.4.0
Array: 0.0049779415130615 MapClosure: 0.0047450065612793 MapNamed: 0.0048999786376953
Output for 5.3.29
Array: 0.0048789978027344 MapClosure: 0.004586935043335 MapNamed: 0.0048198699951172
Output for 5.3.28
Array: 0.0031299591064453 MapClosure: 0.0029940605163574 MapNamed: 0.0032138824462891
Output for 5.3.27
Array: 0.0027840137481689 MapClosure: 0.0028769969940186 MapNamed: 0.0037829875946045
Output for 5.3.26
Array: 0.0032868385314941 MapClosure: 0.0034849643707275 MapNamed: 0.0036020278930664
Output for 5.3.25
Array: 0.0031490325927734 MapClosure: 0.0031459331512451 MapNamed: 0.0034170150756836
Output for 5.3.24
Array: 0.0033729076385498 MapClosure: 0.0032100677490234 MapNamed: 0.0034611225128174
Output for 5.3.23
Array: 0.0032439231872559 MapClosure: 0.0030519962310791 MapNamed: 0.0034630298614502
Output for 5.3.22
Array: 0.0030930042266846 MapClosure: 0.0031721591949463 MapNamed: 0.0035758018493652
Output for 5.3.21
Array: 0.0031149387359619 MapClosure: 0.002953052520752 MapNamed: 0.0032169818878174
Output for 5.3.20
Array: 0.0036079883575439 MapClosure: 0.0039031505584717 MapNamed: 0.0038690567016602
Output for 5.3.19
Array: 0.0037491321563721 MapClosure: 0.0038390159606934 MapNamed: 0.0041449069976807
Output for 5.3.18
Array: 0.0032000541687012 MapClosure: 0.0026998519897461 MapNamed: 0.0028769969940186
Output for 5.3.17
Array: 0.0031490325927734 MapClosure: 0.003291130065918 MapNamed: 0.0035619735717773
Output for 5.3.16
Array: 0.0038459300994873 MapClosure: 0.0034639835357666 MapNamed: 0.003242015838623
Output for 5.3.15
Array: 0.0032129287719727 MapClosure: 0.0031681060791016 MapNamed: 0.0035881996154785
Output for 5.3.14
Array: 0.0045480728149414 MapClosure: 0.0040950775146484 MapNamed: 0.0044231414794922
Output for 5.3.13
Array: 0.0052351951599121 MapClosure: 0.0049779415130615 MapNamed: 0.0046701431274414
Output for 5.3.12
Array: 0.0046319961547852 MapClosure: 0.0048379898071289 MapNamed: 0.0065939426422119
Output for 5.3.11
Array: 0.0054450035095215 MapClosure: 0.0051510334014893 MapNamed: 0.0048151016235352
Output for 5.3.10
Array: 0.0054638385772705 MapClosure: 0.0052640438079834 MapNamed: 0.0056860446929932
Output for 5.3.9
Array: 0.0052380561828613 MapClosure: 0.0049867630004883 MapNamed: 0.005565881729126
Output for 5.3.8
Array: 0.0037789344787598 MapClosure: 0.0038690567016602 MapNamed: 0.0050380229949951
Output for 5.3.7
Array: 0.0072360038757324 MapClosure: 0.0077950954437256 MapNamed: 0.0088410377502441
Output for 5.3.6
Array: 0.0053999423980713 MapClosure: 0.0050208568572998 MapNamed: 0.0038988590240479
Output for 5.3.5
Array: 0.0051610469818115 MapClosure: 0.0050029754638672 MapNamed: 0.0053529739379883
Output for 5.3.4
Array: 0.004688024520874 MapClosure: 0.0061697959899902 MapNamed: 0.0049369335174561
Output for 5.3.3
Array: 0.0055868625640869 MapClosure: 0.0055358409881592 MapNamed: 0.0059161186218262
Output for 5.3.2
Array: 0.0045480728149414 MapClosure: 0.0040009021759033 MapNamed: 0.0045580863952637
Output for 5.3.1
Array: 0.004194974899292 MapClosure: 0.0046801567077637 MapNamed: 0.0045499801635742
Output for 5.3.0
Array: 0.0039980411529541 MapClosure: 0.0032808780670166 MapNamed: 0.0036990642547607
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/k2CNN on line 20
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, expecting ')' in /in/k2CNN on line 20
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/k2CNN on line 20
Process exited with code 255.