3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjArray implements ArrayAccess { private $data; public function toArray() { return $this->data; } public function offsetSet($key, $value) { var_dump($key, $value); $this->data[$key] = $value; } public function offsetGet($key) { return $this->data[$key]; } public function offsetUnset($key) { unset($this->data[$key]); } public function offsetExists($key) { return isset($this->data[$key]); } } $arr = new ObjArray; $arr[0] = 1; $arr[] = 2; var_dump($arr->toArray());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZUfHZ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'objarray'
   34     1        NEW                                              $1      'ObjArray'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   35     4        ASSIGN_DIM                                               !0, 0
          5        OP_DATA                                                  1
   36     6        ASSIGN_DIM                                               !0
          7        OP_DATA                                                  2
   38     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'toArray'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class ObjArray:
Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZUfHZ
function name:  toArray
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'data'
          1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function toarray

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

End of function offsetset

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZUfHZ
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        FETCH_OBJ_R                                      ~1      'data'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   21     4*     > RETURN                                                   null

End of function offsetget

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

End of function offsetunset

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

End of function offsetexists

End of class ObjArray.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.47 ms | 1400 KiB | 15 Q