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) { $obj->do_something(true); } } class bar extends foo { public function do_something (bool $value) { echo "subclass"; } } $a = new foo(); $b = new bar(); $b->call_something($a); $method = new ReflectionMethod($a, 'do_something'); $method->invoke($b, true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Tlgal
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $b, !2 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $3      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   21     3        NEW                                              $6      'bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   22     6        INIT_METHOD_CALL                                         !1, 'call_something'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   24     9        NEW                                              $10     'ReflectionMethod'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAL_EX                                              'do_something'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $10
   25    14        INIT_METHOD_CALL                                         !2, 'invoke'
         15        SEND_VAR_EX                                              !1
         16        SEND_VAL_EX                                              <true>
         17        DO_FCALL                                      0          
         18      > 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/Tlgal
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/Tlgal
function name:  call_something
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_METHOD_CALL                                         !0, 'do_something'
          2        SEND_VAL_EX                                              <true>
          3        DO_FCALL                                      0          
   11     4      > 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/Tlgal
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/Tlgal
function name:  call_something
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_METHOD_CALL                                         !0, 'do_something'
          2        SEND_VAL_EX                                              <true>
          3        DO_FCALL                                      0          
   11     4      > RETURN                                                   null

End of function call_something

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.84 ms | 1399 KiB | 13 Q