3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public function bar() {} } $foo = new Foo(); $method = 'bar'; $args = array(); $iterations = 100000; $cntr = 0; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { $foo->{$method}($args); $cntr++; } echo 'Calling directly on object: ' . (microtime(true) - $start) . ' ' . $cntr . ' times' . PHP_EOL; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { call_user_func(array($foo, $method), $args); } echo 'Calling call_user_func: ' . (microtime(true) - $start) . PHP_EOL;
Output for 7.1.0
Calling directly on object: 0.010632038116455 100000 times Calling call_user_func: 0.016579866409302
Output for 7.0.14
Calling directly on object: 0.013950109481812 100000 times Calling call_user_func: 0.019338130950928
Output for 7.0.6
Calling directly on object: 0.0092949867248535 100000 times Calling call_user_func: 0.016251087188721
Output for 7.0.5
Calling directly on object: 0.010628938674927 100000 times Calling call_user_func: 0.011271953582764
Output for 7.0.4
Calling directly on object: 0.0087430477142334 100000 times Calling call_user_func: 0.015936851501465
Output for 7.0.3
Calling directly on object: 0.005605936050415 100000 times Calling call_user_func: 0.010777950286865
Output for 7.0.2
Calling directly on object: 0.0066609382629395 100000 times Calling call_user_func: 0.014626026153564
Output for 7.0.1
Calling directly on object: 0.0077910423278809 100000 times Calling call_user_func: 0.014260053634644
Output for 7.0.0
Calling directly on object: 0.0053479671478271 100000 times Calling call_user_func: 0.010823011398315
Output for 5.6.28
Calling directly on object: 0.01411509513855 100000 times Calling call_user_func: 0.037055015563965
Output for 5.6.21
Calling directly on object: 0.013082027435303 100000 times Calling call_user_func: 0.046227931976318
Output for 5.6.20
Calling directly on object: 0.011539220809937 100000 times Calling call_user_func: 0.042963027954102
Output for 5.6.19
Calling directly on object: 0.015476226806641 100000 times Calling call_user_func: 0.047603130340576
Output for 5.6.18
Calling directly on object: 0.010450839996338 100000 times Calling call_user_func: 0.035821914672852
Output for 5.6.17
Calling directly on object: 0.010199069976807 100000 times Calling call_user_func: 0.039103031158447
Output for 5.6.16
Calling directly on object: 0.011725902557373 100000 times Calling call_user_func: 0.041692972183228
Output for 5.6.15
Calling directly on object: 0.014461994171143 100000 times Calling call_user_func: 0.048785924911499
Output for 5.6.14
Calling directly on object: 0.01820182800293 100000 times Calling call_user_func: 0.044723033905029
Output for 5.6.13
Calling directly on object: 0.012222051620483 100000 times Calling call_user_func: 0.044929981231689
Output for 5.6.12
Calling directly on object: 0.010248184204102 100000 times Calling call_user_func: 0.038625001907349
Output for 5.6.11
Calling directly on object: 0.010686159133911 100000 times Calling call_user_func: 0.039553880691528
Output for 5.6.10
Calling directly on object: 0.01469087600708 100000 times Calling call_user_func: 0.047760009765625
Output for 5.6.9
Calling directly on object: 0.01528000831604 100000 times Calling call_user_func: 0.042457103729248
Output for 5.6.8
Calling directly on object: 0.015524864196777 100000 times Calling call_user_func: 0.04436182975769
Output for 5.6.7
Calling directly on object: 0.010519027709961 100000 times Calling call_user_func: 0.040482997894287
Output for 5.5.35
Calling directly on object: 0.015852928161621 100000 times Calling call_user_func: 0.051800966262817
Output for 5.5.34
Calling directly on object: 0.014384031295776 100000 times Calling call_user_func: 0.048903942108154
Output for 5.5.33
Calling directly on object: 0.01606297492981 100000 times Calling call_user_func: 0.04563307762146
Output for 5.5.32
Calling directly on object: 0.014529943466187 100000 times Calling call_user_func: 0.048943996429443
Output for 5.5.31
Calling directly on object: 0.01683783531189 100000 times Calling call_user_func: 0.050185918807983
Output for 5.5.30
Calling directly on object: 0.015147924423218 100000 times Calling call_user_func: 0.049756050109863
Output for 5.5.29
Calling directly on object: 0.015129089355469 100000 times Calling call_user_func: 0.05046010017395
Output for 5.5.28
Calling directly on object: 0.016283988952637 100000 times Calling call_user_func: 0.046268939971924
Output for 5.5.27
Calling directly on object: 0.010138988494873 100000 times Calling call_user_func: 0.038509845733643
Output for 5.5.26
Calling directly on object: 0.011184930801392 100000 times Calling call_user_func: 0.041102886199951
Output for 5.5.25
Calling directly on object: 0.010059833526611 100000 times Calling call_user_func: 0.03785514831543
Output for 5.5.24
Calling directly on object: 0.016426086425781 100000 times Calling call_user_func: 0.053934812545776
Output for 5.4.45
Calling directly on object: 0.015074014663696 100000 times Calling call_user_func: 0.042188882827759
Output for 5.4.44
Calling directly on object: 0.017148017883301 100000 times Calling call_user_func: 0.047019958496094
Output for 5.4.43
Calling directly on object: 0.016508102416992 100000 times Calling call_user_func: 0.047743797302246
Output for 5.4.42
Calling directly on object: 0.014694929122925 100000 times Calling call_user_func: 0.042123079299927
Output for 5.4.41
Calling directly on object: 0.017569065093994 100000 times Calling call_user_func: 0.047698974609375
Output for 5.4.40
Calling directly on object: 0.016120910644531 100000 times Calling call_user_func: 0.044967174530029
Output for 5.4.39
Calling directly on object: 0.010868072509766 100000 times Calling call_user_func: 0.033907175064087
Output for 5.4.38
Calling directly on object: 0.017132043838501 100000 times Calling call_user_func: 0.039397001266479
Output for 5.4.37
Calling directly on object: 0.016796112060547 100000 times Calling call_user_func: 0.046117782592773
Output for 5.4.36
Calling directly on object: 0.014368057250977 100000 times Calling call_user_func: 0.04085898399353
Output for 5.4.35
Calling directly on object: 0.010758876800537 100000 times Calling call_user_func: 0.03436017036438
Output for 5.4.34
Calling directly on object: 0.010893821716309 100000 times Calling call_user_func: 0.034012079238892
Output for 5.4.32
Calling directly on object: 0.017162084579468 100000 times Calling call_user_func: 0.043664216995239
Output for 5.4.31
Calling directly on object: 0.017103910446167 100000 times Calling call_user_func: 0.052546977996826
Output for 5.4.30
Calling directly on object: 0.016709089279175 100000 times Calling call_user_func: 0.044765949249268
Output for 5.4.29
Calling directly on object: 0.012075901031494 100000 times Calling call_user_func: 0.036512136459351
Output for 5.4.28
Calling directly on object: 0.010456800460815 100000 times Calling call_user_func: 0.034102201461792
Output for 5.4.27
Calling directly on object: 0.01622200012207 100000 times Calling call_user_func: 0.04237699508667
Output for 5.4.26
Calling directly on object: 0.015206098556519 100000 times Calling call_user_func: 0.043247938156128
Output for 5.4.25
Calling directly on object: 0.016413927078247 100000 times Calling call_user_func: 0.044742822647095
Output for 5.4.24
Calling directly on object: 0.0172119140625 100000 times Calling call_user_func: 0.047821998596191
Output for 5.4.23
Calling directly on object: 0.014647006988525 100000 times Calling call_user_func: 0.042246103286743
Output for 5.4.22
Calling directly on object: 0.013547897338867 100000 times Calling call_user_func: 0.045074939727783
Output for 5.4.21
Calling directly on object: 0.016438961029053 100000 times Calling call_user_func: 0.044361114501953
Output for 5.4.20
Calling directly on object: 0.016819000244141 100000 times Calling call_user_func: 0.04767918586731
Output for 5.4.19
Calling directly on object: 0.015020847320557 100000 times Calling call_user_func: 0.043617963790894
Output for 5.4.18
Calling directly on object: 0.01593804359436 100000 times Calling call_user_func: 0.043230056762695
Output for 5.4.17
Calling directly on object: 0.01142692565918 100000 times Calling call_user_func: 0.034147024154663
Output for 5.4.16
Calling directly on object: 0.013231992721558 100000 times Calling call_user_func: 0.047343969345093
Output for 5.4.15
Calling directly on object: 0.010617971420288 100000 times Calling call_user_func: 0.033712863922119
Output for 5.4.14
Calling directly on object: 0.016649007797241 100000 times Calling call_user_func: 0.042263031005859
Output for 5.4.13
Calling directly on object: 0.011147975921631 100000 times Calling call_user_func: 0.035394906997681
Output for 5.4.12
Calling directly on object: 0.016867160797119 100000 times Calling call_user_func: 0.048460006713867
Output for 5.4.11
Calling directly on object: 0.016841173171997 100000 times Calling call_user_func: 0.050862073898315
Output for 5.4.10
Calling directly on object: 0.015291929244995 100000 times Calling call_user_func: 0.037491798400879
Output for 5.4.9
Calling directly on object: 0.010802984237671 100000 times Calling call_user_func: 0.034235954284668
Output for 5.4.8
Calling directly on object: 0.019345045089722 100000 times Calling call_user_func: 0.045740127563477
Output for 5.4.7
Calling directly on object: 0.016240119934082 100000 times Calling call_user_func: 0.045907974243164
Output for 5.4.6
Calling directly on object: 0.014146089553833 100000 times Calling call_user_func: 0.041555881500244
Output for 5.4.5
Calling directly on object: 0.017565011978149 100000 times Calling call_user_func: 0.046521902084351
Output for 5.4.4
Calling directly on object: 0.016789197921753 100000 times Calling call_user_func: 0.045461893081665
Output for 5.4.3
Calling directly on object: 0.015368938446045 100000 times Calling call_user_func: 0.046370029449463
Output for 5.4.2
Calling directly on object: 0.014987945556641 100000 times Calling call_user_func: 0.044729948043823
Output for 5.4.1
Calling directly on object: 0.01757287979126 100000 times Calling call_user_func: 0.046821117401123
Output for 5.4.0
Calling directly on object: 0.015404939651489 100000 times Calling call_user_func: 0.043639898300171
Output for 5.3.29
Calling directly on object: 0.016775131225586 100000 times Calling call_user_func: 0.045161962509155
Output for 5.3.28
Calling directly on object: 0.019009828567505 100000 times Calling call_user_func: 0.042677879333496
Output for 5.3.27
Calling directly on object: 0.018118143081665 100000 times Calling call_user_func: 0.042946100234985
Output for 5.3.26
Calling directly on object: 0.011977195739746 100000 times Calling call_user_func: 0.036194801330566
Output for 5.3.25
Calling directly on object: 0.018996000289917 100000 times Calling call_user_func: 0.040894031524658
Output for 5.3.24
Calling directly on object: 0.015873908996582 100000 times Calling call_user_func: 0.044528007507324
Output for 5.3.23
Calling directly on object: 0.014778852462769 100000 times Calling call_user_func: 0.042474031448364
Output for 5.3.22
Calling directly on object: 0.018380880355835 100000 times Calling call_user_func: 0.041817903518677
Output for 5.3.21
Calling directly on object: 0.018648862838745 100000 times Calling call_user_func: 0.049643993377686
Output for 5.3.20
Calling directly on object: 0.018222808837891 100000 times Calling call_user_func: 0.049055099487305
Output for 5.3.19
Calling directly on object: 0.01792311668396 100000 times Calling call_user_func: 0.048776865005493
Output for 5.3.18
Calling directly on object: 0.012531995773315 100000 times Calling call_user_func: 0.037062883377075
Output for 5.3.17
Calling directly on object: 0.017714023590088 100000 times Calling call_user_func: 0.049143075942993
Output for 5.3.16
Calling directly on object: 0.012042045593262 100000 times Calling call_user_func: 0.036931991577148
Output for 5.3.15
Calling directly on object: 0.018073081970215 100000 times Calling call_user_func: 0.048064947128296
Output for 5.3.14
Calling directly on object: 0.018369913101196 100000 times Calling call_user_func: 0.050333023071289
Output for 5.3.13
Calling directly on object: 0.014064073562622 100000 times Calling call_user_func: 0.039695978164673
Output for 5.3.12
Calling directly on object: 0.013138055801392 100000 times Calling call_user_func: 0.037374019622803
Output for 5.3.11
Calling directly on object: 0.015480995178223 100000 times Calling call_user_func: 0.040041923522949
Output for 5.3.10
Calling directly on object: 0.015361070632935 100000 times Calling call_user_func: 0.042695999145508
Output for 5.3.9
Calling directly on object: 0.019261121749878 100000 times Calling call_user_func: 0.049467086791992
Output for 5.3.8
Calling directly on object: 0.017046928405762 100000 times Calling call_user_func: 0.044888973236084
Output for 5.3.7
Calling directly on object: 0.017974853515625 100000 times Calling call_user_func: 0.040906190872192
Output for 5.3.6
Calling directly on object: 0.014166116714478 100000 times Calling call_user_func: 0.038241147994995
Output for 5.3.5
Calling directly on object: 0.01654314994812 100000 times Calling call_user_func: 0.049100160598755
Output for 5.3.4
Calling directly on object: 0.020115852355957 100000 times Calling call_user_func: 0.049906969070435
Output for 5.3.3
Calling directly on object: 0.012598991394043 100000 times Calling call_user_func: 0.036819934844971
Output for 5.3.2
Calling directly on object: 0.015737056732178 100000 times Calling call_user_func: 0.043902158737183
Output for 5.3.1
Calling directly on object: 0.019795179367065 100000 times Calling call_user_func: 0.050704002380371
Output for 5.3.0
Calling directly on object: 0.018711090087891 100000 times Calling call_user_func: 0.04790997505188
Output for 5.2.17
Calling directly on object: 0.023380041122437 100000 times Calling call_user_func: 0.062696933746338
Output for 5.2.16
Calling directly on object: 0.017803907394409 100000 times Calling call_user_func: 0.055157899856567
Output for 5.2.15
Calling directly on object: 0.019731044769287 100000 times Calling call_user_func: 0.053910970687866
Output for 5.2.14
Calling directly on object: 0.022387027740479 100000 times Calling call_user_func: 0.061146974563599
Output for 5.2.13
Calling directly on object: 0.024991035461426 100000 times Calling call_user_func: 0.064532995223999
Output for 5.2.12
Calling directly on object: 0.0208580493927 100000 times Calling call_user_func: 0.057486057281494
Output for 5.2.11
Calling directly on object: 0.025491952896118 100000 times Calling call_user_func: 0.066437005996704
Output for 5.2.10
Calling directly on object: 0.027179956436157 100000 times Calling call_user_func: 0.066959857940674
Output for 5.2.9
Calling directly on object: 0.025825023651123 100000 times Calling call_user_func: 0.066715955734253
Output for 5.2.8
Calling directly on object: 0.026188135147095 100000 times Calling call_user_func: 0.064506053924561
Output for 5.2.7
Calling directly on object: 0.02538800239563 100000 times Calling call_user_func: 0.063553094863892
Output for 5.2.6
Calling directly on object: 0.018269062042236 100000 times Calling call_user_func: 0.055590867996216
Output for 5.2.5
Calling directly on object: 0.016454935073853 100000 times Calling call_user_func: 0.052818059921265
Output for 5.2.4
Calling directly on object: 0.016749858856201 100000 times Calling call_user_func: 0.055599927902222
Output for 5.2.3
Calling directly on object: 0.021237134933472 100000 times Calling call_user_func: 0.059525966644287
Output for 5.2.2
Calling directly on object: 0.02390718460083 100000 times Calling call_user_func: 0.063633918762207
Output for 5.2.1
Calling directly on object: 0.017999887466431 100000 times Calling call_user_func: 0.052788972854614
Output for 5.2.0
Calling directly on object: 0.016901969909668 100000 times Calling call_user_func: 0.051679134368896
Output for 5.1.6
Calling directly on object: 0.017921924591064 100000 times Calling call_user_func: 0.051587820053101
Output for 5.1.5
Calling directly on object: 0.016700029373169 100000 times Calling call_user_func: 0.050277948379517
Output for 5.1.4
Calling directly on object: 0.025460004806519 100000 times Calling call_user_func: 0.062134981155396
Output for 5.1.3
Calling directly on object: 0.018050909042358 100000 times Calling call_user_func: 0.048994064331055
Output for 5.1.2
Calling directly on object: 0.025154829025269 100000 times Calling call_user_func: 0.060806035995483
Output for 5.1.1
Calling directly on object: 0.027734041213989 100000 times Calling call_user_func: 0.060739994049072
Output for 5.1.0
Calling directly on object: 0.014771938323975 100000 times Calling call_user_func: 0.043455839157104
Output for 5.0.5
Calling directly on object: 0.060188055038452 100000 times Calling call_user_func: 0.07855486869812
Output for 5.0.4
Calling directly on object: 0.062267065048218 100000 times Calling call_user_func: 0.078851938247681
Output for 5.0.3
Calling directly on object: 0.051239967346191 100000 times Calling call_user_func: 0.069683074951172
Output for 5.0.2
Calling directly on object: 0.05439281463623 100000 times Calling call_user_func: 0.07338809967041
Output for 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iaDn1 on line 22 Calling directly on object: 0.056182861328125 100000 timesPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iaDn1 on line 29 Calling call_user_func: 0.076215028762817PHP_EOL
Output for 5.0.0
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iaDn1 on line 22 Calling directly on object: 0.046347141265869 100000 timesPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iaDn1 on line 29 Calling call_user_func: 0.064601898193359PHP_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/iaDn1 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/iaDn1 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/iaDn1 on line 5
Process exited with code 255.