3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Testme { public static function foo(&$ref, &$ref2) { $ref = 1; $ref2 = 2; } } class Invoker { public static function invoke($func_name, &$arg1 = null, &$arg2 = null, &$arg3 = null, &$arg4 = null, &$arg5 = null, &$arg6 = null) { $argc = func_num_args(); $args = array(); for($i = 1; $i < $argc; $i++) { $name = 'arg' . $i; if ($$name !== null) { $args[] = &$$name; } } call_user_func_array(array('Testme', $func_name), $args); } } $test = 5; $test2 = 6; Invoker::invoke('foo', $test, $test2); var_dump($test); var_dump($test2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Okvk0
function name:  (null)
number of ops:  14
compiled vars:  !0 = $test, !1 = $test2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                   !0, 5
   29     1        ASSIGN                                                   !1, 6
   30     2        INIT_STATIC_METHOD_CALL                                  'Invoker', 'invoke'
          3        SEND_VAL                                                 'foo'
          4        SEND_REF                                                 !0
          5        SEND_REF                                                 !1
          6        DO_FCALL                                      0          
   32     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   33    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Testme:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Okvk0
function name:  foo
number of ops:  5
compiled vars:  !0 = $ref, !1 = $ref2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !0, 1
    6     3        ASSIGN                                                   !1, 2
    7     4      > 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 = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
Branch analysis from position: 12
Branch analysis from position: 21
filename:       /in/Okvk0
function name:  invoke
number of ops:  31
compiled vars:  !0 = $func_name, !1 = $arg1, !2 = $arg2, !3 = $arg3, !4 = $arg4, !5 = $arg5, !6 = $arg6, !7 = $argc, !8 = $args, !9 = $i, !10 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
          3        RECV_INIT                                        !3      null
          4        RECV_INIT                                        !4      null
          5        RECV_INIT                                        !5      null
          6        RECV_INIT                                        !6      null
   16     7        FUNC_NUM_ARGS                                    ~11     
          8        ASSIGN                                                   !7, ~11
   17     9        ASSIGN                                                   !8, <array>
   18    10        ASSIGN                                                   !9, 1
         11      > JMP                                                      ->22
   19    12    >   CONCAT                                           ~15     'arg', !9
         13        ASSIGN                                                   !10, ~15
   20    14        FETCH_R                      local               ~17     !10
         15        TYPE_CHECK                                  1020          ~17
         16      > JMPZ                                                     ~18, ->21
   21    17    >   FETCH_W                      local               $20     !10
         18        MAKE_REF                                         $21     $20
         19        FETCH_DIM_W                                      $19     !8
         20        ASSIGN_REF                                               $19, $21
   18    21    >   PRE_INC                                                  !9
         22    >   IS_SMALLER                                               !9, !7
         23      > JMPNZ                                                    ~24, ->12
   24    24    >   INIT_ARRAY                                       ~25     'Testme'
         25        ADD_ARRAY_ELEMENT                                ~25     !0
         26        INIT_USER_CALL                                0          'call_user_func_array', ~25
         27        SEND_ARRAY                                               !8
         28        CHECK_UNDEF_ARGS                                         
         29        DO_FCALL                                      0          
   25    30      > RETURN                                                   null

End of function invoke

End of class Invoker.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1400 KiB | 15 Q