3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Testme { public static function foo(&$ref) { $ref = 1; } } class Invoker { public static function invoke($func_name) { $args = func_get_args(); call_user_func_array(array('Testme', $func_name), array_slice($args,1)); } } $test = 2; $testRef = &$test; Invoker::invoke('foo', $testRef); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/us6QO
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test, !1 = $testRef
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 2
   16     1        ASSIGN_REF                                               !1, !0
   17     2        INIT_STATIC_METHOD_CALL                                  'Invoker', 'invoke'
          3        SEND_VAL                                                 'foo'
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
   18     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function foo

End of class Testme.

Class Invoker:
Function invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/us6QO
function name:  invoke
number of ops:  14
compiled vars:  !0 = $func_name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        FUNC_GET_ARGS                                    ~2      
          2        ASSIGN                                                   !1, ~2
   11     3        INIT_ARRAY                                       ~4      'Testme'
          4        ADD_ARRAY_ELEMENT                                ~4      !0
          5        INIT_USER_CALL                                0          'call_user_func_array', ~4
          6        INIT_FCALL                                               'array_slice'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $5      
         10        SEND_ARRAY                                               $5
         11        CHECK_UNDEF_ARGS                                         
         12        DO_FCALL                                      0          
   12    13      > RETURN                                                   null

End of function invoke

End of class Invoker.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.66 ms | 1396 KiB | 17 Q