3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { function foobar() { echo 'test'; } } class Foo { public $bar; public function __call($method, $args) { call_user_func_array(array($this->bar, $method), $args); } } $foo = new Foo; $foo->bar = new Bar; var_dump(method_exists($foo, 'bar')); var_dump(is_callable(array($foo, 'bar')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ubPmJ
function name:  (null)
number of ops:  23
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        NEW                                              $5      'Bar'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               !0, 'bar'
          6        OP_DATA                                                  $5
   21     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'method_exists'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'bar'
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
   22    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'is_callable'
         16        INIT_ARRAY                                       ~9      !0
         17        ADD_ARRAY_ELEMENT                                ~9      'bar'
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

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

End of function foobar

End of class Bar.

Class Foo:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ubPmJ
function name:  __call
number of ops:  10
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        FETCH_OBJ_R                                      ~2      'bar'
          3        INIT_ARRAY                                       ~3      ~2
          4        ADD_ARRAY_ELEMENT                                ~3      !0
          5        INIT_USER_CALL                                0          'call_user_func_array', ~3
          6        SEND_ARRAY                                               !1
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      0          
   13     9      > RETURN                                                   null

End of function __call

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.38 ms | 1400 KiB | 19 Q