3v4l.org

run code in 300+ PHP versions simultaneously
<?php function by_ref(&$arg) { $arg = 42; } class ModuleHandler { public function invokeAll($hook, $args) { $args_by_ref = array(); foreach ($args as $key => $arg) { $args_by_ref[$key] = &$args[$key]; } call_user_func_array('by_ref', $args_by_ref); } } $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/A2oSh
function name:  (null)
number of ops:  18
compiled vars:  !0 = $moduleHandler, !1 = $x, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $3      'ModuleHandler'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   18     3        INIT_METHOD_CALL                                         !0, 'invokeAll'
          4        SEND_VAL_EX                                              'example'
          5        SEND_VAL_EX                                              <array>
          6        DO_FCALL                                      0          
   20     7        ASSIGN                                                   !1, 25
   21     8        INIT_ARRAY                                       ~8      !1, 0
          9        ASSIGN                                                   !2, ~8
   23    10        INIT_METHOD_CALL                                         !0, 'invokeAll'
         11        SEND_VAL_EX                                              'example'
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0          
   25    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/A2oSh
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
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/A2oSh
function name:  invokeAll
number of ops:  17
compiled vars:  !0 = $hook, !1 = $args, !2 = $args_by_ref, !3 = $arg, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ASSIGN                                                   !2, <array>
   10     3      > FE_RESET_R                                       $6      !1, ->11
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->11
          5    >   ASSIGN                                                   !4, ~7
   11     6        FETCH_DIM_W                                      $10     !1, !4
          7        MAKE_REF                                         $11     $10
          8        FETCH_DIM_W                                      $9      !2, !4
          9        ASSIGN_REF                                               $9, $11
   10    10      > JMP                                                      ->4
         11    >   FE_FREE                                                  $6
   13    12        INIT_FCALL                                               'by_ref'
         13        SEND_ARRAY                                               !2
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      1          
   14    16      > RETURN                                                   null

End of function invokeall

End of class ModuleHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
229.12 ms | 1017 KiB | 15 Q