3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Obj implements ArrayAccess { public $container = [ "one" => 1, "two" => 2, "three" => 3, ]; public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset): bool { return isset($this->container[$offset]); } public function offsetUnset($offset): void { unset($this->container[$offset]); } public function offsetGet($offset): mixed { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } $obj = new Obj; takesArray($obj); function takesArray(array $arr) {}
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csROV
function name:  (null)
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'obj'
   30     1        NEW                                                  $1      'Obj'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   32     4        INIT_FCALL_BY_NAME                                           'takesArray'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
   34     7      > RETURN                                                       1

Function takesarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csROV
function name:  takesArray
number of ops:  2
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          0  E >   RECV                                                 !0      
          1      > RETURN                                                       null

End of function takesarray

Class Obj:
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/csROV
function name:  offsetSet
number of ops:  12
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2        TYPE_CHECK                                        2          !0
          3      > JMPZ                                                         ~2, ->8
   11     4    >   FETCH_OBJ_W                                          $3      'container'
          5        ASSIGN_DIM                                                   $3
          6        OP_DATA                                                      !1
   10     7      > JMP                                                          ->11
   13     8    >   FETCH_OBJ_W                                          $5      'container'
          9        ASSIGN_DIM                                                   $5, !0
         10        OP_DATA                                                      !1
   15    11    > > RETURN                                                       null

End of function offsetset

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csROV
function name:  offsetExists
number of ops:  7
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        FETCH_OBJ_IS                                         ~1      'container'
          2        ISSET_ISEMPTY_DIM_OBJ                             0  ~2      ~1, !0
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   19     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function offsetexists

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csROV
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
   22     1        FETCH_OBJ_UNSET                                      $1      'container'
          2        UNSET_DIM                                                    $1, !0
   23     3      > RETURN                                                       null

End of function offsetunset

Function offsetget:
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 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csROV
function name:  offsetGet
number of ops:  12
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
   26     1        FETCH_OBJ_IS                                         ~1      'container'
          2        ISSET_ISEMPTY_DIM_OBJ                             0          ~1, !0
          3      > JMPZ                                                         ~2, ->8
          4    >   FETCH_OBJ_R                                          ~3      'container'
          5        FETCH_DIM_R                                          ~4      ~3, !0
          6        QM_ASSIGN                                            ~5      ~4
          7      > JMP                                                          ->9
          8    >   QM_ASSIGN                                            ~5      null
          9    > > RETURN                                                       ~5
   27    10*       VERIFY_RETURN_TYPE                                           
         11*     > RETURN                                                       null

End of function offsetget

End of class Obj.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.69 ms | 1474 KiB | 13 Q