3v4l.org

run code in 300+ PHP versions simultaneously
<?php // essentially tests/classes/array_access_012.phpt, with offsetGet returning by-ref class ArrayAccessImpl implements ArrayAccess { private $data = array(); public function offsetUnset($index) {} public function offsetSet($index, $value) { $this->data[$index] = $value; } public function &offsetGet($index) { return $this->data[$index]; } public function offsetExists($index) { return isset($this->data[$index]); } } $data = new ArrayAccessImpl(); $test = 'some data'; $data['element'] = NULL; // prevent notice $data['element'] = &$test; var_dump($data['element']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmZcJ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $data, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'arrayaccessimpl'
   22     1        NEW                                              $2      'ArrayAccessImpl'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   23     4        ASSIGN                                                   !1, 'some+data'
   24     5        ASSIGN_DIM                                               !0, 'element'
          6        OP_DATA                                                  null
   25     7        FETCH_DIM_W                                      $7      !0, 'element'
          8        ASSIGN_REF                                               $7, !1
   26     9        INIT_FCALL                                               'var_dump'
         10        FETCH_DIM_R                                      ~9      !0, 'element'
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function offsetunset

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UmZcJ
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $index, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   11     5      > RETURN                                                   null

End of function offsetset

Function offsetget:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/UmZcJ
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_W                                      $1      'data'
          2        FETCH_DIM_W                                      $2      $1, !0
          3      > RETURN_BY_REF                                            $2
   15     4*     > RETURN_BY_REF                                            null

End of function offsetget

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

End of function offsetexists

End of class ArrayAccessImpl.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.73 ms | 1392 KiB | 15 Q