3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static $mem; static function setMem( &$v ) { self::$mem[ $v[0] ] = $v[1]; } static function readMem( &$v ) { $a = $v[3]; $v[2][$a] =& self::$mem[ $v[1] ]; } static function reset( &$v ) { reset( $v[0] ); } static function each( &$v ) { var_dump( $v ); $t = each( $v[0] ); self::$mem[ $v[1] ] = $t[1]; } static function show( &$v ) { echo $v[0]; } } $reset = array(null); $each = array(null, 'new'); $show = array(null); $arr = array( array('variable', array(1, 2, 3) ), array( 1=>'variable', 3=>0 ), array(), array( 1=>'variable', 3=>0 ), $each, array( 1=>'new', 3=>0 ),// 5 $show, ); $arr[1][2] =& $reset; $arr[2][0] =& $reset; $arr[3][2] =& $each; $arr[5][2] =& $show; $n = 0; foo::setMem( $arr[$n++] ); // 0 foo::readMem( $arr[$n++] ); // 1 foo::reset( $arr[$n++] ); // 2 foo::readMem( $arr[$n++] ); // 3 var_dump( $each ); foo::each( $arr[$n++] ); // 4 foo::readMem( $arr[$n++] ); // 5 foo::show( $arr[$n++] ); // 6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  (null)
number of ops:  63
compiled vars:  !0 = $reset, !1 = $each, !2 = $show, !3 = $arr, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ASSIGN                                                   !0, <array>
   31     1        ASSIGN                                                   !1, <array>
   32     2        ASSIGN                                                   !2, <array>
   36     3        INIT_ARRAY                                       ~8      <array>
          4        ADD_ARRAY_ELEMENT                                ~8      <array>
          5        ADD_ARRAY_ELEMENT                                ~8      <array>
          6        ADD_ARRAY_ELEMENT                                ~8      <array>
   40     7        ADD_ARRAY_ELEMENT                                ~8      !1
   36     8        ADD_ARRAY_ELEMENT                                ~8      <array>
   42     9        ADD_ARRAY_ELEMENT                                ~8      !2
   35    10        ASSIGN                                                   !3, ~8
   44    11        FETCH_DIM_W                                      $10     !3, 1
         12        FETCH_DIM_W                                      $11     $10, 2
         13        ASSIGN_REF                                               $11, !0
   45    14        FETCH_DIM_W                                      $13     !3, 2
         15        FETCH_DIM_W                                      $14     $13, 0
         16        ASSIGN_REF                                               $14, !0
   46    17        FETCH_DIM_W                                      $16     !3, 3
         18        FETCH_DIM_W                                      $17     $16, 2
         19        ASSIGN_REF                                               $17, !1
   47    20        FETCH_DIM_W                                      $19     !3, 5
         21        FETCH_DIM_W                                      $20     $19, 2
         22        ASSIGN_REF                                               $20, !2
   49    23        ASSIGN                                                   !4, 0
   50    24        INIT_STATIC_METHOD_CALL                                  'foo', 'setMem'
         25        POST_INC                                         ~23     !4
         26        FETCH_DIM_W                                      $24     !3, ~23
         27        SEND_REF                                                 $24
         28        DO_FCALL                                      0          
   51    29        INIT_STATIC_METHOD_CALL                                  'foo', 'readMem'
         30        POST_INC                                         ~26     !4
         31        FETCH_DIM_W                                      $27     !3, ~26
         32        SEND_REF                                                 $27
         33        DO_FCALL                                      0          
   52    34        INIT_STATIC_METHOD_CALL                                  'foo', 'reset'
         35        POST_INC                                         ~29     !4
         36        FETCH_DIM_W                                      $30     !3, ~29
         37        SEND_REF                                                 $30
         38        DO_FCALL                                      0          
   53    39        INIT_STATIC_METHOD_CALL                                  'foo', 'readMem'
         40        POST_INC                                         ~32     !4
         41        FETCH_DIM_W                                      $33     !3, ~32
         42        SEND_REF                                                 $33
         43        DO_FCALL                                      0          
   54    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                                 
   55    47        INIT_STATIC_METHOD_CALL                                  'foo', 'each'
         48        POST_INC                                         ~36     !4
         49        FETCH_DIM_W                                      $37     !3, ~36
         50        SEND_REF                                                 $37
         51        DO_FCALL                                      0          
   56    52        INIT_STATIC_METHOD_CALL                                  'foo', 'readMem'
         53        POST_INC                                         ~39     !4
         54        FETCH_DIM_W                                      $40     !3, ~39
         55        SEND_REF                                                 $40
         56        DO_FCALL                                      0          
   57    57        INIT_STATIC_METHOD_CALL                                  'foo', 'show'
         58        POST_INC                                         ~42     !4
         59        FETCH_DIM_W                                      $43     !3, ~42
         60        SEND_REF                                                 $43
         61        DO_FCALL                                      0          
         62      > RETURN                                                   1

Class foo:
Function setmem:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  setMem
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        FETCH_DIM_R                                      ~2      !0, 0
          2        FETCH_DIM_R                                      ~4      !0, 1
          3        FETCH_STATIC_PROP_W          global              $1      'mem'
          4        ASSIGN_DIM                                               $1, ~2
          5        OP_DATA                                                  ~4
    8     6      > RETURN                                                   null

End of function setmem

Function readmem:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  readMem
number of ops:  11
compiled vars:  !0 = $v, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_DIM_R                                      ~2      !0, 3
          2        ASSIGN                                                   !1, ~2
   12     3        FETCH_DIM_R                                      ~7      !0, 1
          4        FETCH_STATIC_PROP_W          global              $6      'mem'
          5        FETCH_DIM_W                                      $8      $6, ~7
          6        MAKE_REF                                         $9      $8
          7        FETCH_DIM_W                                      $4      !0, 2
          8        FETCH_DIM_W                                      $5      $4, !1
          9        ASSIGN_REF                                               $5, $9
   13    10      > RETURN                                                   null

End of function readmem

Function reset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  reset
number of ops:  6
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'reset'
          2        FETCH_DIM_W                                      $1      !0, 0
          3        SEND_REF                                                 $1
          4        DO_ICALL                                                 
   17     5      > RETURN                                                   null

End of function reset

Function each:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  each
number of ops:  16
compiled vars:  !0 = $v, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   21     4        INIT_FCALL_BY_NAME                                       'each'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_DIM_FUNC_ARG                               $3      !0, 0
          7        SEND_FUNC_ARG                                            $3
          8        DO_FCALL                                      0  $4      
          9        ASSIGN                                                   !1, $4
   22    10        FETCH_DIM_R                                      ~7      !0, 1
         11        FETCH_DIM_R                                      ~9      !1, 1
         12        FETCH_STATIC_PROP_W          unknown             $6      'mem'
         13        ASSIGN_DIM                                               $6, ~7
         14        OP_DATA                                                  ~9
   23    15      > RETURN                                                   null

End of function each

Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWJna
function name:  show
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   25     1        FETCH_DIM_R                                      ~1      !0, 0
          2        ECHO                                                     ~1
   26     3      > RETURN                                                   null

End of function show

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.93 ms | 1404 KiB | 17 Q