3v4l.org

run code in 500+ PHP versions simultaneously
<?php function hook( &$x, &$y, $w, $z ) { $x++; $y++; $w++; $z++; } class Hooks { public static function run( $name, $args ) { call_user_func_array( $name, $args ); } public static function run2( $name, $args ) { $args2 = []; foreach ( $args as &$arg ) { $args2[] = &$arg; } call_user_func_array( $name, $args2 ); } } $x = $y = $w = $z = 0; echo "start: $x:$y:$w:$z\n\n"; Hooks::run( 'hook', [ $x, &$y, $w, &$z ] ); echo "run: $x:$y:$w:$z\n\n"; Hooks::run2( 'hook', [ $x, &$y, $w, &$z ] ); echo "run2: $x:$y:$w:$z\n\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nlVpT
function name:  (null)
number of ops:  51
compiled vars:  !0 = $x, !1 = $y, !2 = $w, !3 = $z
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                               ~4      !3, 0
          1        ASSIGN                                               ~5      !2, ~4
          2        ASSIGN                                               ~6      !1, ~5
          3        ASSIGN                                                       !0, ~6
   22     4        ROPE_INIT                                         9  ~9      'start%3A+'
          5        ROPE_ADD                                          1  ~9      ~9, !0
          6        ROPE_ADD                                          2  ~9      ~9, '%3A'
          7        ROPE_ADD                                          3  ~9      ~9, !1
          8        ROPE_ADD                                          4  ~9      ~9, '%3A'
          9        ROPE_ADD                                          5  ~9      ~9, !2
         10        ROPE_ADD                                          6  ~9      ~9, '%3A'
         11        ROPE_ADD                                          7  ~9      ~9, !3
         12        ROPE_END                                          8  ~8      ~9, '%0A%0A'
         13        ECHO                                                         ~8
   24    14        INIT_STATIC_METHOD_CALL                                      'Hooks', 'run'
         15        SEND_VAL                                                     'hook'
         16        INIT_ARRAY                                           ~14     !0
         17        ADD_ARRAY_ELEMENT                                    ~14     !1
         18        ADD_ARRAY_ELEMENT                                    ~14     !2
         19        ADD_ARRAY_ELEMENT                                    ~14     !3
         20        SEND_VAL                                                     ~14
         21        DO_FCALL                                          0          
   25    22        ROPE_INIT                                         9  ~17     'run%3A+'
         23        ROPE_ADD                                          1  ~17     ~17, !0
         24        ROPE_ADD                                          2  ~17     ~17, '%3A'
         25        ROPE_ADD                                          3  ~17     ~17, !1
         26        ROPE_ADD                                          4  ~17     ~17, '%3A'
         27        ROPE_ADD                                          5  ~17     ~17, !2
         28        ROPE_ADD                                          6  ~17     ~17, '%3A'
         29        ROPE_ADD                                          7  ~17     ~17, !3
         30        ROPE_END                                          8  ~16     ~17, '%0A%0A'
         31        ECHO                                                         ~16
   27    32        INIT_STATIC_METHOD_CALL                                      'Hooks', 'run2'
         33        SEND_VAL                                                     'hook'
         34        INIT_ARRAY                                           ~22     !0
         35        ADD_ARRAY_ELEMENT                                    ~22     !1
         36        ADD_ARRAY_ELEMENT                                    ~22     !2
         37        ADD_ARRAY_ELEMENT                                    ~22     !3
         38        SEND_VAL                                                     ~22
         39        DO_FCALL                                          0          
   28    40        ROPE_INIT                                         9  ~25     'run2%3A+'
         41        ROPE_ADD                                          1  ~25     ~25, !0
         42        ROPE_ADD                                          2  ~25     ~25, '%3A'
         43        ROPE_ADD                                          3  ~25     ~25, !1
         44        ROPE_ADD                                          4  ~25     ~25, '%3A'
         45        ROPE_ADD                                          5  ~25     ~25, !2
         46        ROPE_ADD                                          6  ~25     ~25, '%3A'
         47        ROPE_ADD                                          7  ~25     ~25, !3
         48        ROPE_END                                          8  ~24     ~25, '%0A%0A'
         49        ECHO                                                         ~24
         50      > RETURN                                                       1

Function hook:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nlVpT
function name:  hook
number of ops:  9
compiled vars:  !0 = $x, !1 = $y, !2 = $w, !3 = $z
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
    4     4        PRE_INC                                                      !0
          5        PRE_INC                                                      !1
          6        PRE_INC                                                      !2
          7        PRE_INC                                                      !3
    5     8      > RETURN                                                       null

End of function hook

Class Hooks:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nlVpT
function name:  run
number of ops:  7
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    9     2        INIT_USER_CALL                                    0          'call_user_func_array', !0
          3        SEND_ARRAY                                                   !1
          4        CHECK_UNDEF_ARGS                                             
          5        DO_FCALL                                          1          
   10     6      > RETURN                                                       null

End of function run

Function run2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/nlVpT
function name:  run2
number of ops:  14
compiled vars:  !0 = $name, !1 = $args, !2 = $args2, !3 = $arg
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   13     2        ASSIGN                                                       !2, <array>
   14     3      > FE_RESET_RW                                          $5      !1, ->8
          4    > > FE_FETCH_RW                                                  $5, !3, ->8
   15     5    >   FETCH_DIM_W                                          $6      !2
          6        ASSIGN_REF                                                   $6, !3
   14     7      > JMP                                                          ->4
          8    >   FE_FREE                                                      $5
   17     9        INIT_USER_CALL                                    0          'call_user_func_array', !0
         10        SEND_ARRAY                                                   !2
         11        CHECK_UNDEF_ARGS                                             
         12        DO_FCALL                                          1          
   18    13      > RETURN                                                       null

End of function run2

End of class Hooks.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.92 ms | 3325 KiB | 13 Q