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

End of function call_something

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.52 ms | 1399 KiB | 13 Q