3v4l.org

run code in 500+ PHP versions simultaneously
<?php function by_ref(&$arg) { $arg = 42; } class ModuleHandler { public function invokeAll($hook, $args) { by_ref($args[0]); } } $moduleHandler = new ModuleHandler(); $moduleHandler->invokeAll('example', array(23)); $x = 25; $array = array(0 => &$x); $moduleHandler->invokeAll('example', $array); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H3FsW
function name:  (null)
number of ops:  18
compiled vars:  !0 = $moduleHandler, !1 = $x, !2 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $3      'ModuleHandler'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   14     3        INIT_METHOD_CALL                                             !0, 'invokeAll'
          4        SEND_VAL_EX                                                  'example'
          5        SEND_VAL_EX                                                  <array>
          6        DO_FCALL                                          0          
   16     7        ASSIGN                                                       !1, 25
   17     8        INIT_ARRAY                                           ~8      !1, 0
          9        ASSIGN                                                       !2, ~8
   19    10        INIT_METHOD_CALL                                             !0, 'invokeAll'
         11        SEND_VAL_EX                                                  'example'
         12        SEND_VAR_EX                                                  !2
         13        DO_FCALL                                          0          
   21    14        INIT_FCALL                                                   'var_dump'
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

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

End of function by_ref

Class ModuleHandler:
Function invokeall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H3FsW
function name:  invokeAll
number of ops:  7
compiled vars:  !0 = $hook, !1 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    9     2        INIT_FCALL                                                   'by_ref'
          3        FETCH_DIM_W                                          $2      !1, 0
          4        SEND_REF                                                     $2
          5        DO_FCALL                                          0          
   10     6      > RETURN                                                       null

End of function invokeall

End of class ModuleHandler.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.48 ms | 2112 KiB | 15 Q