3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayAccessable implements ArrayAccess { protected $_container = array(); public function __construct($array = null) { if (!is_null($array)) { $this->_container = $array; } } public function offsetExists($offset) { return isset($this->_container[$offset]); } public function offsetGet($offset) { return $this->offsetExists($offset) ? $this->_container[$offset] : null; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->_container[] = $value; } else { $this->_container[$offset] = $value; } } public function offsetUnset($offset) { unset($this->_container[$offset]); } } $array = new ArrayAccessable(array('a', 'b', 'c', 'd', 'e' => 'assoc')); var_dump($array); unset($array['e']); var_dump('unset: ', $array); $array['meta'] = 'additional element'; var_dump('set: ', $array); var_dump(count($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAHRR
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'arrayaccessable'
   40     1        NEW                                              $1      'ArrayAccessable'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   41     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   43     8        UNSET_DIM                                                !0, 'e'
   44     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAL                                                 'unset%3A+'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   46    13        ASSIGN_DIM                                               !0, 'meta'
         14        OP_DATA                                                  'additional+element'
   47    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAL                                                 'set%3A+'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   49    19        INIT_FCALL                                               'var_dump'
         20        COUNT                                            ~8      !0
         21        SEND_VAL                                                 ~8
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAHRR
function name:  offsetGet
number of ops:  12
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        INIT_METHOD_CALL                                         'offsetExists'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->9
          5    >   FETCH_OBJ_R                                      ~2      '_container'
          6        FETCH_DIM_R                                      ~3      ~2, !0
          7        QM_ASSIGN                                        ~4      ~3
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~4      null
         10    > > RETURN                                                   ~4
   23    11*     > 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/tAHRR
function name:  offsetSet
number of ops:  12
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        TYPE_CHECK                                    2          !0
          3      > JMPZ                                                     ~2, ->8
   28     4    >   FETCH_OBJ_W                                      $3      '_container'
          5        ASSIGN_DIM                                               $3
          6        OP_DATA                                                  !1
          7      > JMP                                                      ->11
   30     8    >   FETCH_OBJ_W                                      $5      '_container'
          9        ASSIGN_DIM                                               $5, !0
         10        OP_DATA                                                  !1
   32    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/tAHRR
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        FETCH_OBJ_UNSET                                  $1      '_container'
          2        UNSET_DIM                                                $1, !0
   37     3      > RETURN                                                   null

End of function offsetunset

End of class ArrayAccessable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.22 ms | 1409 KiB | 15 Q