3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private function do_something (bool $str) { echo "private function"; } public function call_something(foo $obj) { call_user_func([$obj, 'do_something'], true); } } class bar extends foo { public function do_something (bool $value) { echo "subclass"; } } $a = new foo(); $b = new bar(); $a->call_something($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH9g5
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        NEW                                              $5      'bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   22     6        INIT_METHOD_CALL                                         !0, 'call_something'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class foo:
Function do_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH9g5
function name:  do_something
number of ops:  3
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ECHO                                                     'private+function'
    7     2      > RETURN                                                   null

End of function do_something

Function call_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH9g5
function name:  call_something
number of ops:  7
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_ARRAY                                       ~1      !0
          2        ADD_ARRAY_ELEMENT                                ~1      'do_something'
          3        INIT_USER_CALL                                1          'call_user_func', ~1
          4        SEND_USER                                                <true>
          5        DO_FCALL                                      0          
   11     6      > RETURN                                                   null

End of function call_something

End of class foo.

Class bar:
Function do_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH9g5
function name:  do_something
number of ops:  3
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ECHO                                                     'subclass'
   17     2      > RETURN                                                   null

End of function do_something

Function call_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH9g5
function name:  call_something
number of ops:  7
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_ARRAY                                       ~1      !0
          2        ADD_ARRAY_ELEMENT                                ~1      'do_something'
          3        INIT_USER_CALL                                1          'call_user_func', ~1
          4        SEND_USER                                                <true>
          5        DO_FCALL                                      0          
   11     6      > RETURN                                                   null

End of function call_something

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.34 ms | 1390 KiB | 13 Q