3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Data implements \ArrayAccess { private $_data; public function __construct($data = []) { $this->_data = $data; } public function offsetExists($offset) { echo 'EXISTS: ' . $offset . PHP_EOL; return isset($this->_data[$offset]); } public function &offsetGet($offset) { echo 'GET: ' . $offset . PHP_EOL; $returnValue = null; if (!isset($this->_data[$offset])) { return $returnValue; } $returnValue = $this->_data[$offset]; return $returnValue; } public function offsetSet($offset, $value) { $this->_data[$offset] = $value; } public function offsetUnset($offset) { unset($this->_data[$offset]); } } $data = new Data(); $data['aaaaa']['bbbbbb']['ccccc']='dddddd'; var_dump($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iLnkW
function name:  (null)
number of ops:  12
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'data'
   43     1        NEW                                              $1      'Data'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   46     4        FETCH_DIM_W                                      $4      !0, 'aaaaa'
          5        FETCH_DIM_W                                      $5      $4, 'bbbbbb'
          6        ASSIGN_DIM                                               $5, 'ccccc'
          7        OP_DATA                                                  'dddddd'
   47     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Data:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iLnkW
function name:  __construct
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      <array>
   10     1        ASSIGN_OBJ                                               '_data'
          2        OP_DATA                                                  !0
   11     3      > 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/iLnkW
function name:  offsetExists
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        CONCAT                                           ~1      'EXISTS%3A+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   16     4        FETCH_OBJ_IS                                     ~3      '_data'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      ~3, !0
          6      > RETURN                                                   ~4
   17     7*     > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
Return found
Branch analysis from position: 10
Return found
filename:       /in/iLnkW
function name:  offsetGet
number of ops:  15
compiled vars:  !0 = $offset, !1 = $returnValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        CONCAT                                           ~2      'GET%3A+', !0
          2        CONCAT                                           ~3      ~2, '%0A'
          3        ECHO                                                     ~3
   22     4        ASSIGN                                                   !1, null
   23     5        FETCH_OBJ_IS                                     ~5      '_data'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      ~5, !0
          7        BOOL_NOT                                         ~7      ~6
          8      > JMPZ                                                     ~7, ->10
   24     9    > > RETURN_BY_REF                                            !1
   26    10    >   FETCH_OBJ_R                                      ~8      '_data'
         11        FETCH_DIM_R                                      ~9      ~8, !0
         12        ASSIGN                                                   !1, ~9
   27    13      > RETURN_BY_REF                                            !1
   28    14*     > RETURN_BY_REF                                            null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iLnkW
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   32     2        FETCH_OBJ_W                                      $2      '_data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   33     5      > 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/iLnkW
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      '_data'
          2        UNSET_DIM                                                $1, !0
   38     3      > RETURN                                                   null

End of function offsetunset

End of class Data.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.52 ms | 1400 KiB | 15 Q