3v4l.org

run code in 500+ PHP versions simultaneously
<?php class AATest implements ArrayAccess { protected $array = array(); // ArrayAccess interface public function offsetExists($offset) { return key_exists($offset, $this->array); } public function offsetGet($offset) { return $this->array[$offset]; } public function offsetSet($offset, $value) { if( is_null($offset) ) { $this->array[] = $value; } else { $this->array[$offset] = $value; } } public function offsetUnset($offset) { unset($this->array[$offset]); } // debug public function dbgGetArray() { return $this->array; } } $object = new AATest(); $object[] = 'a'; $object[NULL] = 'b'; $object[] = 'c'; var_dump($object->dbgGetArray()); $array = array(); $array[] = 'a'; $array[NULL] = 'b'; $array[] = 'c'; var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OC9qQ
function name:  (null)
number of ops:  26
compiled vars:  !0 = $object, !1 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'aatest'
   30     1        NEW                                                  $2      'AATest'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   31     4        ASSIGN_DIM                                                   !0
          5        OP_DATA                                                      'a'
   32     6        ASSIGN_DIM                                                   !0, null
          7        OP_DATA                                                      'b'
   33     8        ASSIGN_DIM                                                   !0
          9        OP_DATA                                                      'c'
   35    10        INIT_FCALL                                                   'var_dump'
         11        INIT_METHOD_CALL                                             !0, 'dbgGetArray'
         12        DO_FCALL                                          0  $8      
         13        SEND_VAR                                                     $8
         14        DO_ICALL                                                     
   37    15        ASSIGN                                                       !1, <array>
   38    16        ASSIGN_DIM                                                   !1
         17        OP_DATA                                                      'a'
   39    18        ASSIGN_DIM                                                   !1, null
         19        OP_DATA                                                      'b'
   40    20        ASSIGN_DIM                                                   !1
         21        OP_DATA                                                      'c'
   42    22        INIT_FCALL                                                   'var_dump'
         23        SEND_VAR                                                     !1
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Class AATest:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OC9qQ
function name:  offsetExists
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        INIT_FCALL                                                   'key_exists'
          2        SEND_VAR                                                     !0
          3        FETCH_OBJ_R                                          ~1      'array'
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                             $2      
          6      > RETURN                                                       $2
    9     7*     > RETURN                                                       null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OC9qQ
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   11     1        FETCH_OBJ_R                                          ~1      'array'
          2        FETCH_DIM_R                                          ~2      ~1, !0
          3      > RETURN                                                       ~2
   12     4*     > RETURN                                                       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/OC9qQ
function name:  offsetSet
number of ops:  12
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   14     2        TYPE_CHECK                                        2          !0
          3      > JMPZ                                                         ~2, ->8
   15     4    >   FETCH_OBJ_W                                          $3      'array'
          5        ASSIGN_DIM                                                   $3
          6        OP_DATA                                                      !1
   14     7      > JMP                                                          ->11
   17     8    >   FETCH_OBJ_W                                          $5      'array'
          9        ASSIGN_DIM                                                   $5, !0
         10        OP_DATA                                                      !1
   19    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/OC9qQ
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
   21     1        FETCH_OBJ_UNSET                                      $1      'array'
          2        UNSET_DIM                                                    $1, !0
   22     3      > RETURN                                                       null

End of function offsetunset

Function dbggetarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OC9qQ
function name:  dbgGetArray
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                          ~0      'array'
          1      > RETURN                                                       ~0
   27     2*     > RETURN                                                       null

End of function dbggetarray

End of class AATest.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.97 ms | 2956 KiB | 10 Q