3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(&$arg1) { var_dump('arg1: ', $arg1); } } class B extends A { public function bar() { $x = new stdClass(); $x->baz = 'just a value'; $this->callPrivate($x); } private function callPrivate($x) { $method = new \ReflectionMethod( 'A', 'foo' ); //working 5.4 (* see above) but not in 5.5 $arguments = func_get_args(); return $method->invokeArgs($this, $arguments); } } $obj = new B; $obj->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0T3de
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0T3de
function name:  foo
number of ops:  6
compiled vars:  !0 = $arg1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'arg1%3A+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    5     5      > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0T3de
function name:  bar
number of ops:  9
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        ASSIGN_OBJ                                               !0, 'baz'
          4        OP_DATA                                                  'just+a+value'
   12     5        INIT_METHOD_CALL                                         'callPrivate'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
   13     8      > RETURN                                                   null

End of function bar

Function callprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0T3de
function name:  callPrivate
number of ops:  15
compiled vars:  !0 = $x, !1 = $method, !2 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        NEW                                              $3      'ReflectionMethod'
   18     2        SEND_VAL_EX                                              'A'
   19     3        SEND_VAL_EX                                              'foo'
          4        DO_FCALL                                      0          
   17     5        ASSIGN                                                   !1, $3
   23     6        FUNC_GET_ARGS                                    ~6      
          7        ASSIGN                                                   !2, ~6
   25     8        INIT_METHOD_CALL                                         !1, 'invokeArgs'
          9        FETCH_THIS                                       $8      
         10        SEND_VAR_EX                                              $8
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0  $9      
         13      > RETURN                                                   $9
   26    14*     > RETURN                                                   null

End of function callprivate

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0T3de
function name:  foo
number of ops:  6
compiled vars:  !0 = $arg1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'arg1%3A+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    5     5      > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.37 ms | 1400 KiB | 15 Q