3v4l.org

run code in 500+ PHP versions simultaneously
<?php class test implements ArrayAccess { public $v; function __construct() { $this->v = array( 'a' => array('b' => 'c'), 'd' => array('e' => 'f'), 'g' => array('h' => 'i') ); } function offsetExists($offset) { return isset($this->v); } function &offsetGet($offset) { return $this->v[$offset]; } function offsetSet($offset, $value) { if (is_null($offset)) { $this->v[] = $value; } else { $this->v[$offset] = $value; } } function offsetUnset($offset) { unset($this->v[$offset]); } } $test = new test(); $test['a']['b'] = 'zzz'; $test['new']['nested'] = 'xxx'; print_r($test->v);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSvuA
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                                'test'
   41     1        NEW                                                  $1      'test'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   42     4        FETCH_DIM_W                                          $4      !0, 'a'
          5        ASSIGN_DIM                                                   $4, 'b'
          6        OP_DATA                                                      'zzz'
   43     7        FETCH_DIM_W                                          $6      !0, 'new'
          8        ASSIGN_DIM                                                   $6, 'nested'
          9        OP_DATA                                                      'xxx'
   44    10        INIT_FCALL                                                   'print_r'
         11        FETCH_OBJ_R                                          ~8      !0, 'v'
         12        SEND_VAL                                                     ~8
         13        DO_ICALL                                                     
         14      > RETURN                                                       1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSvuA
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                                   'v'
   10     1        OP_DATA                                                      <array>
   14     2      > RETURN                                                       null

End of function __construct

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSvuA
function name:  offsetExists
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   18     1        ISSET_ISEMPTY_PROP_OBJ                               ~1      'v'
          2      > RETURN                                                       ~1
   19     3*     > RETURN                                                       null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/OSvuA
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
   23     1        FETCH_OBJ_W                                          $1      'v'
          2        FETCH_DIM_W                                          $2      $1, !0
          3      > RETURN_BY_REF                                                $2
   24     4*     > RETURN_BY_REF                                                null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSvuA
function name:  offsetSet
number of ops:  12
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   28     2        TYPE_CHECK                                        2          !0
          3      > JMPZ                                                         ~2, ->8
   29     4    >   FETCH_OBJ_W                                          $3      'v'
          5        ASSIGN_DIM                                                   $3
          6        OP_DATA                                                      !1
   28     7      > JMP                                                          ->11
   31     8    >   FETCH_OBJ_W                                          $5      'v'
          9        ASSIGN_DIM                                                   $5, !0
         10        OP_DATA                                                      !1
   33    11    > > RETURN                                                       null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSvuA
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
   37     1        FETCH_OBJ_UNSET                                      $1      'v'
          2        UNSET_DIM                                                    $1, !0
   38     3      > RETURN                                                       null

End of function offsetunset

End of class test.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.05 ms | 3129 KiB | 14 Q