3v4l.org

run code in 300+ PHP versions simultaneously
<?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;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 36
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 36
Branch analysis from position: 44
Branch analysis from position: 36
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 13
Branch analysis from position: 20
Branch analysis from position: 13
filename:       /in/iaDn1
function name:  (null)
number of ops:  52
compiled vars:  !0 = $foo, !1 = $method, !2 = $args, !3 = $iterations, !4 = $cntr, !5 = $start, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $7      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $7
   10     3        ASSIGN                                                   !1, 'bar'
   11     4        ASSIGN                                                   !2, <array>
   13     5        ASSIGN                                                   !3, 100000
   14     6        ASSIGN                                                   !4, 0
   16     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !5, $14
   17    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->18
   18    13    >   INIT_METHOD_CALL                                         !0, !1
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
   19    16        PRE_INC                                                  !4
   17    17        PRE_INC                                                  !6
         18    >   IS_SMALLER                                               !6, !3
         19      > JMPNZ                                                    ~20, ->13
   22    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $21     
         23        SUB                                              ~22     $21, !5
         24        CONCAT                                           ~23     'Calling+directly+on+object%3A+', ~22
         25        CONCAT                                           ~24     ~23, '+'
         26        CONCAT                                           ~25     ~24, !4
         27        CONCAT                                           ~26     ~25, '+times'
         28        CONCAT                                           ~27     ~26, '%0A'
         29        ECHO                                                     ~27
   24    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $28     
         33        ASSIGN                                                   !5, $28
   25    34        ASSIGN                                                   !6, 0
         35      > JMP                                                      ->42
   26    36    >   INIT_ARRAY                                       ~31     !0
         37        ADD_ARRAY_ELEMENT                                ~31     !1
         38        INIT_USER_CALL                                1          'call_user_func', ~31
         39        SEND_USER                                                !2
         40        DO_FCALL                                      0          
   25    41        PRE_INC                                                  !6
         42    >   IS_SMALLER                                               !6, !3
         43      > JMPNZ                                                    ~34, ->36
   29    44    >   INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $35     
         47        SUB                                              ~36     $35, !5
         48        CONCAT                                           ~37     'Calling+call_user_func%3A+', ~36
         49        CONCAT                                           ~38     ~37, '%0A'
         50        ECHO                                                     ~38
         51      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iaDn1
function name:  bar
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.6 ms | 1405 KiB | 15 Q