3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public function bar() {} } $foo = new Foo(); $method = 'bar'; $args = array(); $call_func_method = array($foo, $method); $iterations = 100000; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { $foo->{$method}($args); } echo 'Calling directly on object: ' . (microtime(true) - $start) . PHP_EOL; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { call_user_func($call_func_method, $args); } echo 'Calling call_user_func: ' . (microtime(true) - $start) . PHP_EOL;
Output for 7.1.0
Calling directly on object: 0.0082859992980957 Calling call_user_func: 0.0095269680023193
Output for 7.0.14
Calling directly on object: 0.012225866317749 Calling call_user_func: 0.012514114379883
Output for 7.0.12
Calling directly on object: 0.0092079639434814 Calling call_user_func: 0.011214971542358
Output for 7.0.6
Calling directly on object: 0.0083260536193848 Calling call_user_func: 0.010016202926636
Output for 7.0.5
Calling directly on object: 0.005728006362915 Calling call_user_func: 0.0066931247711182
Output for 7.0.4
Calling directly on object: 0.0076539516448975 Calling call_user_func: 0.0085299015045166
Output for 7.0.3
Calling directly on object: 0.0061638355255127 Calling call_user_func: 0.0070650577545166
Output for 7.0.2
Calling directly on object: 0.0061180591583252 Calling call_user_func: 0.0071530342102051
Output for 7.0.1
Calling directly on object: 0.005357027053833 Calling call_user_func: 0.0062019824981689
Output for 7.0.0
Calling directly on object: 0.0066220760345459 Calling call_user_func: 0.0083739757537842
Output for 5.6.28
Calling directly on object: 0.015290021896362 Calling call_user_func: 0.036255836486816
Output for 5.6.21
Calling directly on object: 0.0094380378723145 Calling call_user_func: 0.028536081314087
Output for 5.6.20
Calling directly on object: 0.013251781463623 Calling call_user_func: 0.036602973937988
Output for 5.6.19
Calling directly on object: 0.011806964874268 Calling call_user_func: 0.027647972106934
Output for 5.6.18
Calling directly on object: 0.0094809532165527 Calling call_user_func: 0.023432970046997
Output for 5.6.17
Calling directly on object: 0.0094428062438965 Calling call_user_func: 0.029011964797974
Output for 5.6.16
Calling directly on object: 0.012110948562622 Calling call_user_func: 0.033622980117798
Output for 5.6.15
Calling directly on object: 0.0090780258178711 Calling call_user_func: 0.027529954910278
Output for 5.6.14
Calling directly on object: 0.013521909713745 Calling call_user_func: 0.036767959594727
Output for 5.6.13
Calling directly on object: 0.012729167938232 Calling call_user_func: 0.037306070327759
Output for 5.6.12
Calling directly on object: 0.01112699508667 Calling call_user_func: 0.031378030776978
Output for 5.6.11
Calling directly on object: 0.014662981033325 Calling call_user_func: 0.038810968399048
Output for 5.6.10
Calling directly on object: 0.0193190574646 Calling call_user_func: 0.041654109954834
Output for 5.6.9
Calling directly on object: 0.015601873397827 Calling call_user_func: 0.039086103439331
Output for 5.6.8
Calling directly on object: 0.014201879501343 Calling call_user_func: 0.038640022277832
Output for 5.6.7
Calling directly on object: 0.0096368789672852 Calling call_user_func: 0.029831886291504
Output for 5.5.35
Calling directly on object: 0.012280941009521 Calling call_user_func: 0.033777952194214
Output for 5.5.34
Calling directly on object: 0.0093748569488525 Calling call_user_func: 0.028244972229004
Output for 5.5.33
Calling directly on object: 0.0097689628601074 Calling call_user_func: 0.023743152618408
Output for 5.5.32
Calling directly on object: 0.0095140933990479 Calling call_user_func: 0.028625011444092
Output for 5.5.31
Calling directly on object: 0.0092101097106934 Calling call_user_func: 0.030416965484619
Output for 5.5.30
Calling directly on object: 0.011157989501953 Calling call_user_func: 0.031630039215088
Output for 5.5.29
Calling directly on object: 0.011908769607544 Calling call_user_func: 0.033155918121338
Output for 5.5.28
Calling directly on object: 0.01410698890686 Calling call_user_func: 0.038305997848511
Output for 5.5.27
Calling directly on object: 0.017096042633057 Calling call_user_func: 0.043894052505493
Output for 5.5.26
Calling directly on object: 0.011523008346558 Calling call_user_func: 0.035882949829102
Output for 5.5.25
Calling directly on object: 0.01092004776001 Calling call_user_func: 0.030564785003662
Output for 5.5.24
Calling directly on object: 0.016258955001831 Calling call_user_func: 0.042584896087646
Output for 5.4.45
Calling directly on object: 0.016079187393188 Calling call_user_func: 0.033950090408325
Output for 5.4.44
Calling directly on object: 0.01549506187439 Calling call_user_func: 0.03308892250061
Output for 5.4.43
Calling directly on object: 0.018554925918579 Calling call_user_func: 0.033546924591064
Output for 5.4.42
Calling directly on object: 0.015404939651489 Calling call_user_func: 0.032959938049316
Output for 5.4.41
Calling directly on object: 0.01610803604126 Calling call_user_func: 0.03375506401062
Output for 5.4.40
Calling directly on object: 0.015068054199219 Calling call_user_func: 0.028172016143799
Output for 5.4.39
Calling directly on object: 0.015460968017578 Calling call_user_func: 0.033229112625122
Output for 5.4.38
Calling directly on object: 0.015950918197632 Calling call_user_func: 0.035057783126831
Output for 5.4.37
Calling directly on object: 0.015478849411011 Calling call_user_func: 0.03340220451355
Output for 5.4.36
Calling directly on object: 0.016232967376709 Calling call_user_func: 0.034018993377686
Output for 5.4.35
Calling directly on object: 0.012423992156982 Calling call_user_func: 0.028631925582886
Output for 5.4.34
Calling directly on object: 0.011168003082275 Calling call_user_func: 0.025040864944458
Output for 5.4.32
Calling directly on object: 0.0098831653594971 Calling call_user_func: 0.023999929428101
Output for 5.4.31
Calling directly on object: 0.015274047851562 Calling call_user_func: 0.03350305557251
Output for 5.4.30
Calling directly on object: 0.016649007797241 Calling call_user_func: 0.033756017684937
Output for 5.4.29
Calling directly on object: 0.014853000640869 Calling call_user_func: 0.029578924179077
Output for 5.4.28
Calling directly on object: 0.014725923538208 Calling call_user_func: 0.033170938491821
Output for 5.4.27
Calling directly on object: 0.012906789779663 Calling call_user_func: 0.0293869972229
Output for 5.4.26
Calling directly on object: 0.014127016067505 Calling call_user_func: 0.031485080718994
Output for 5.4.25
Calling directly on object: 0.01546311378479 Calling call_user_func: 0.034806966781616
Output for 5.4.24
Calling directly on object: 0.014147996902466 Calling call_user_func: 0.031646966934204
Output for 5.4.23
Calling directly on object: 0.015561103820801 Calling call_user_func: 0.033957958221436
Output for 5.4.22
Calling directly on object: 0.014778137207031 Calling call_user_func: 0.033573150634766
Output for 5.4.21
Calling directly on object: 0.012145042419434 Calling call_user_func: 0.027359962463379
Output for 5.4.20
Calling directly on object: 0.010073900222778 Calling call_user_func: 0.02419900894165
Output for 5.4.19
Calling directly on object: 0.015610218048096 Calling call_user_func: 0.033957958221436
Output for 5.4.18
Calling directly on object: 0.015182018280029 Calling call_user_func: 0.033240079879761
Output for 5.4.17
Calling directly on object: 0.015477180480957 Calling call_user_func: 0.033859968185425
Output for 5.4.16
Calling directly on object: 0.015412092208862 Calling call_user_func: 0.033653020858765
Output for 5.4.15
Calling directly on object: 0.016360998153687 Calling call_user_func: 0.032444000244141
Output for 5.4.14
Calling directly on object: 0.012634992599487 Calling call_user_func: 0.029906988143921
Output for 5.4.13
Calling directly on object: 0.014441967010498 Calling call_user_func: 0.032634973526001
Output for 5.4.12
Calling directly on object: 0.010205984115601 Calling call_user_func: 0.024186849594116
Output for 5.4.11
Calling directly on object: 0.0096371173858643 Calling call_user_func: 0.024254083633423
Output for 5.4.10
Calling directly on object: 0.009937047958374 Calling call_user_func: 0.024050235748291
Output for 5.4.9
Calling directly on object: 0.015795946121216 Calling call_user_func: 0.034370899200439
Output for 5.4.8
Calling directly on object: 0.016132831573486 Calling call_user_func: 0.037049055099487
Output for 5.4.7
Calling directly on object: 0.01134991645813 Calling call_user_func: 0.026548147201538
Output for 5.4.6
Calling directly on object: 0.011353969573975 Calling call_user_func: 0.025813817977905
Output for 5.4.5
Calling directly on object: 0.016420125961304 Calling call_user_func: 0.030375957489014
Output for 5.4.4
Calling directly on object: 0.016382932662964 Calling call_user_func: 0.035038948059082
Output for 5.4.3
Calling directly on object: 0.011687040328979 Calling call_user_func: 0.025128126144409
Output for 5.4.2
Calling directly on object: 0.011255979537964 Calling call_user_func: 0.025483131408691
Output for 5.4.1
Calling directly on object: 0.012714862823486 Calling call_user_func: 0.027053833007812
Output for 5.4.0
Calling directly on object: 0.011292934417725 Calling call_user_func: 0.028373956680298
Output for 5.3.29
Calling directly on object: 0.013489007949829 Calling call_user_func: 0.031429052352905
Output for 5.3.28
Calling directly on object: 0.016417026519775 Calling call_user_func: 0.03580117225647
Output for 5.3.27
Calling directly on object: 0.013888835906982 Calling call_user_func: 0.030704021453857
Output for 5.3.26
Calling directly on object: 0.014549016952515 Calling call_user_func: 0.033245086669922
Output for 5.3.25
Calling directly on object: 0.013324022293091 Calling call_user_func: 0.030674934387207
Output for 5.3.24
Calling directly on object: 0.016653060913086 Calling call_user_func: 0.036100149154663
Output for 5.3.23
Calling directly on object: 0.016556024551392 Calling call_user_func: 0.033199071884155
Output for 5.3.22
Calling directly on object: 0.016117095947266 Calling call_user_func: 0.03397798538208
Output for 5.3.21
Calling directly on object: 0.018349170684814 Calling call_user_func: 0.040688991546631
Output for 5.3.20
Calling directly on object: 0.010942935943604 Calling call_user_func: 0.026417970657349
Output for 5.3.19
Calling directly on object: 0.016831874847412 Calling call_user_func: 0.037509202957153
Output for 5.3.18
Calling directly on object: 0.017075061798096 Calling call_user_func: 0.037863969802856
Output for 5.3.17
Calling directly on object: 0.016071081161499 Calling call_user_func: 0.036640882492065
Output for 5.3.16
Calling directly on object: 0.013243913650513 Calling call_user_func: 0.029762983322144
Output for 5.3.15
Calling directly on object: 0.014811992645264 Calling call_user_func: 0.033262968063354
Output for 5.3.14
Calling directly on object: 0.017220973968506 Calling call_user_func: 0.039776086807251
Output for 5.3.13
Calling directly on object: 0.014408111572266 Calling call_user_func: 0.031702041625977
Output for 5.3.12
Calling directly on object: 0.014037847518921 Calling call_user_func: 0.032249927520752
Output for 5.3.11
Calling directly on object: 0.018742799758911 Calling call_user_func: 0.038909912109375
Output for 5.3.10
Calling directly on object: 0.016630887985229 Calling call_user_func: 0.037329912185669
Output for 5.3.9
Calling directly on object: 0.017269849777222 Calling call_user_func: 0.034974813461304
Output for 5.3.8
Calling directly on object: 0.013577938079834 Calling call_user_func: 0.028065204620361
Output for 5.3.7
Calling directly on object: 0.017074108123779 Calling call_user_func: 0.034677028656006
Output for 5.3.6
Calling directly on object: 0.018812894821167 Calling call_user_func: 0.038655042648315
Output for 5.3.5
Calling directly on object: 0.016826152801514 Calling call_user_func: 0.0364990234375
Output for 5.3.4
Calling directly on object: 0.016975879669189 Calling call_user_func: 0.031508922576904
Output for 5.3.3
Calling directly on object: 0.01072096824646 Calling call_user_func: 0.026048183441162
Output for 5.3.2
Calling directly on object: 0.014286994934082 Calling call_user_func: 0.034394979476929
Output for 5.3.1
Calling directly on object: 0.011225938796997 Calling call_user_func: 0.02570915222168
Output for 5.3.0
Calling directly on object: 0.010512828826904 Calling call_user_func: 0.025515794754028
Output for 5.2.17
Calling directly on object: 0.022953987121582 Calling call_user_func: 0.050200939178467
Output for 5.2.16
Calling directly on object: 0.014018058776855 Calling call_user_func: 0.036761999130249
Output for 5.2.15
Calling directly on object: 0.014111995697021 Calling call_user_func: 0.036307811737061
Output for 5.2.14
Calling directly on object: 0.014262914657593 Calling call_user_func: 0.037476062774658
Output for 5.2.13
Calling directly on object: 0.014181137084961 Calling call_user_func: 0.036251068115234
Output for 5.2.12
Calling directly on object: 0.014355897903442 Calling call_user_func: 0.037806034088135
Output for 5.2.11
Calling directly on object: 0.020017862319946 Calling call_user_func: 0.051966905593872
Output for 5.2.10
Calling directly on object: 0.013324022293091 Calling call_user_func: 0.035656929016113
Output for 5.2.9
Calling directly on object: 0.013611078262329 Calling call_user_func: 0.035479784011841
Output for 5.2.8
Calling directly on object: 0.013314008712769 Calling call_user_func: 0.034785032272339
Output for 5.2.7
Calling directly on object: 0.013834953308105 Calling call_user_func: 0.034882068634033
Output for 5.2.6
Calling directly on object: 0.013761043548584 Calling call_user_func: 0.035098075866699
Output for 5.2.5
Calling directly on object: 0.012993097305298 Calling call_user_func: 0.034461975097656
Output for 5.2.4
Calling directly on object: 0.012945175170898 Calling call_user_func: 0.035175085067749
Output for 5.2.3
Calling directly on object: 0.013684988021851 Calling call_user_func: 0.037282943725586
Output for 5.2.2
Calling directly on object: 0.016039848327637 Calling call_user_func: 0.040687084197998
Output for 5.2.1
Calling directly on object: 0.012131929397583 Calling call_user_func: 0.034397125244141
Output for 5.2.0
Calling directly on object: 0.015156030654907 Calling call_user_func: 0.036147832870483
Output for 5.1.6
Calling directly on object: 0.013617992401123 Calling call_user_func: 0.033093214035034
Output for 5.1.5
Calling directly on object: 0.01302695274353 Calling call_user_func: 0.032555103302002
Output for 5.1.4
Calling directly on object: 0.013093948364258 Calling call_user_func: 0.032849073410034
Output for 5.1.3
Calling directly on object: 0.015760898590088 Calling call_user_func: 0.038862943649292
Output for 5.1.2
Calling directly on object: 0.01298713684082 Calling call_user_func: 0.032647132873535
Output for 5.1.1
Calling directly on object: 0.013186931610107 Calling call_user_func: 0.030516862869263
Output for 5.1.0
Calling directly on object: 0.013020038604736 Calling call_user_func: 0.031378030776978
Output for 5.0.5
Calling directly on object: 0.027848958969116 Calling call_user_func: 0.046036005020142
Output for 5.0.4
Calling directly on object: 0.028385877609253 Calling call_user_func: 0.047451019287109
Output for 5.0.3
Calling directly on object: 0.027774095535278 Calling call_user_func: 0.045650959014893
Output for 5.0.2
Calling directly on object: 0.034211874008179 Calling call_user_func: 0.047700881958008
Output for 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/aLOYh on line 22 Calling directly on object: 0.030407905578613PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/aLOYh on line 29 Calling call_user_func: 0.046938896179199PHP_EOL
Output for 5.0.0
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/aLOYh on line 22 Calling directly on object: 0.03706693649292PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/aLOYh on line 29 Calling call_user_func: 0.052922964096069PHP_EOL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/aLOYh on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/aLOYh on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/aLOYh on line 5
Process exited with code 255.