3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyStorage implements ArrayAccess { private $map; public function offsetExists($n){ return isset($this->map[$n]); } public function offsetGet($n){ return $this->map[$n]; } public function offsetSet($n, $v){ $this->map[$n] = $v; } public function offsetUnset($n){ unset($this->map[$n]); } } $s = new MyStorage(); $s['blah'] = ['a' => 1, 'b' => 2, 'c' => 3]; var_dump($s['blah']); $s['blah']['a'] = 10; var_dump($s['blah']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0Okl
function name:  (null)
number of ops:  18
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'mystorage'
   11     1        NEW                                              $1      'MyStorage'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   12     4        ASSIGN_DIM                                               !0, 'blah'
          5        OP_DATA                                                  <array>
   13     6        INIT_FCALL                                               'var_dump'
          7        FETCH_DIM_R                                      ~5      !0, 'blah'
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                                 
   15    10        FETCH_DIM_W                                      $7      !0, 'blah'
         11        ASSIGN_DIM                                               $7, 'a'
         12        OP_DATA                                                  10
   16    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~9      !0, 'blah'
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class MyStorage:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0Okl
function name:  offsetExists
number of ops:  5
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        FETCH_OBJ_IS                                     ~1      'map'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3      > RETURN                                                   ~2
          4*     > 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/r0Okl
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        FETCH_OBJ_R                                      ~1      'map'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   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/r0Okl
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $n, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_OBJ_W                                      $2      'map'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
          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/r0Okl
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        FETCH_OBJ_UNSET                                  $1      'map'
          2        UNSET_DIM                                                $1, !0
          3      > RETURN                                                   null

End of function offsetunset

End of class MyStorage.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.87 ms | 1015 KiB | 14 Q