3v4l.org

run code in 500+ PHP versions simultaneously
<?php class foo { public function bar($a) { echo $a; } } class not_foo { public function bar($a) { echo "not $a"; } } $r = new ReflectionClass('foo'); $m = $r->getMethod('bar'); $m->invoke(new not_foo, 'baz');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sCFcA
function name:  (null)
number of ops:  15
compiled vars:  !0 = $r, !1 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $2      'ReflectionClass'
          1        SEND_VAL_EX                                                  'foo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   20     4        INIT_METHOD_CALL                                             !0, 'getMethod'
          5        SEND_VAL_EX                                                  'bar'
          6        DO_FCALL                                          0  $5      
          7        ASSIGN                                                       !1, $5
   21     8        INIT_METHOD_CALL                                             !1, 'invoke'
          9        NEW                                                  $7      'not_foo'
         10        DO_FCALL                                          0          
         11        SEND_VAR_NO_REF_EX                                           $7
         12        SEND_VAL_EX                                                  'baz'
         13        DO_FCALL                                          0          
         14      > RETURN                                                       1

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

End of function bar

End of class foo.

Class not_foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sCFcA
function name:  bar
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   15     1        NOP                                                          
          2        FAST_CONCAT                                          ~1      'not+', !0
          3        ECHO                                                         ~1
   16     4      > RETURN                                                       null

End of function bar

End of class not_foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.45 ms | 2316 KiB | 13 Q