3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(E_ALL); class MyArray implements ArrayAccess { public $value; public function __construct($value = null) { $this->value = $value; } public function &offsetGet($offset) { var_dump(__METHOD__); if (!isset($this->value[$offset])) { $this->value[$offset] = null; } return $this->value[$offset]; } public function offsetExists($offset) { var_dump(__METHOD__); return isset($this->value[$offset]); } public function offsetSet($offset, $value) { var_dump(__METHOD__); $this->value[$offset] = $value; } public function offsetUnset($offset) { var_dump(__METHOD__); $this->value[$offset] = null; } } $record = new MyArray([ 'foo' => [ 'bar' => 'baz' ] ]); var_dump(isset($record['foo']['bar'])); var_dump(isset($record['hello']['world']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vOeG0
function name:  (null)
number of ops:  19
compiled vars:  !0 = $record
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     30719
          2        DO_ICALL                                                     
    5     3        DECLARE_CLASS                                                'myarray'
   47     4        NEW                                                  $2      'MyArray'
   49     5        SEND_VAL_EX                                                  <array>
   47     6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $2
   53     8        INIT_FCALL                                                   'var_dump'
          9        FETCH_DIM_IS                                         ~5      !0, 'foo'
         10        ISSET_ISEMPTY_DIM_OBJ                             0  ~6      ~5, 'bar'
         11        SEND_VAL                                                     ~6
         12        DO_ICALL                                                     
   54    13        INIT_FCALL                                                   'var_dump'
         14        FETCH_DIM_IS                                         ~8      !0, 'hello'
         15        ISSET_ISEMPTY_DIM_OBJ                             0  ~9      ~8, 'world'
         16        SEND_VAL                                                     ~9
         17        DO_ICALL                                                     
         18      > RETURN                                                       1

Class MyArray:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vOeG0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                            !0      null
   11     1        ASSIGN_OBJ                                                   'value'
          2        OP_DATA                                                      !0
   12     3      > RETURN                                                       null

End of function __construct

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
Return found
Branch analysis from position: 11
filename:       /in/vOeG0
function name:  offsetGet
number of ops:  15
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   16     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     'MyArray%3A%3AoffsetGet'
          3        DO_ICALL                                                     
   18     4        FETCH_OBJ_IS                                         ~2      'value'
          5        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      ~2, !0
          6        BOOL_NOT                                             ~4      ~3
          7      > JMPZ                                                         ~4, ->11
   19     8    >   FETCH_OBJ_W                                          $5      'value'
          9        ASSIGN_DIM                                                   $5, !0
         10        OP_DATA                                                      null
   22    11    >   FETCH_OBJ_W                                          $7      'value'
         12        FETCH_DIM_W                                          $8      $7, !0
         13      > RETURN_BY_REF                                                $8
   23    14*     > RETURN_BY_REF                                                null

End of function offsetget

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vOeG0
function name:  offsetExists
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
   27     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     'MyArray%3A%3AoffsetExists'
          3        DO_ICALL                                                     
   29     4        FETCH_OBJ_IS                                         ~2      'value'
          5        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      ~2, !0
          6      > RETURN                                                       ~3
   30     7*     > RETURN                                                       null

End of function offsetexists

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vOeG0
function name:  offsetSet
number of ops:  9
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   34     2        INIT_FCALL                                                   'var_dump'
          3        SEND_VAL                                                     'MyArray%3A%3AoffsetSet'
          4        DO_ICALL                                                     
   36     5        FETCH_OBJ_W                                          $3      'value'
          6        ASSIGN_DIM                                                   $3, !0
          7        OP_DATA                                                      !1
   37     8      > 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/vOeG0
function name:  offsetUnset
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   39     0  E >   RECV                                                 !0      
   41     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     'MyArray%3A%3AoffsetUnset'
          3        DO_ICALL                                                     
   43     4        FETCH_OBJ_W                                          $2      'value'
          5        ASSIGN_DIM                                                   $2, !0
          6        OP_DATA                                                      null
   44     7      > RETURN                                                       null

End of function offsetunset

End of class MyArray.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
185.44 ms | 3443 KiB | 15 Q