3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=64417 trait aa { private $container = array(); public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function &offsetGet($offset) { $result = null; if (isset($this->container[$offset])) { $result = &$this->container[$offset]; } return $result; } } class obj implements ArrayAccess { use aa; } $o = new obj; $o['x'] = 1; ++$o['x']; echo $o['x'], "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rsXrR
function name:  (null)
number of ops:  12
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   DECLARE_CLASS                                            'obj'
   32     1        NEW                                              $1      'obj'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   33     4        ASSIGN_DIM                                               !0, 'x'
          5        OP_DATA                                                  1
   34     6        FETCH_DIM_RW                                     $5      !0, 'x'
          7        PRE_INC                                                  $5
   35     8        FETCH_DIM_R                                      ~7      !0, 'x'
          9        ECHO                                                     ~7
         10        ECHO                                                     '%0A'
         11      > RETURN                                                   1

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

End of function offsetunset

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
Return found
Branch analysis from position: 8
filename:       /in/rsXrR
function name:  offsetGet
number of ops:  10
compiled vars:  !0 = $offset, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN                                                   !1, null
   21     2        FETCH_OBJ_IS                                     ~3      'container'
          3        ISSET_ISEMPTY_DIM_OBJ                         0          ~3, !0
          4      > JMPZ                                                     ~4, ->8
   22     5    >   FETCH_OBJ_W                                      $5      'container'
          6        FETCH_DIM_W                                      $6      $5, !0
          7        ASSIGN_REF                                               !1, $6
   24     8    > > RETURN_BY_REF                                            !1
   25     9*     > RETURN_BY_REF                                            null

End of function offsetget

End of class aa.

Class obj: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.51 ms | 1399 KiB | 13 Q