3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements ArrayAccess { public function offsetGet($k) { echo "offsetGet: "; var_dump($k); } public function offsetSet($k, $v) { echo "offsetSet: "; var_dump($k); } public function offsetExists($k) { echo "offsetExists: "; var_dump($k); } public function offsetUnset($k) { echo "offsetUnset: "; var_dump($k); } } $x = new C(); var_dump($x['123']); var_dump($x['123'] = 4); var_dump(isset($x['123'])); unset($x['123']); echo "--------\n"; var_dump($x[$k='123']); var_dump($x[$k='123'] = 4); var_dump(isset($x[$k='123'])); unset($x[$k='123']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MOPti
function name:  (null)
number of ops:  38
compiled vars:  !0 = $x, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'c'
   20     1        NEW                                              $2      'C'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   23     4        INIT_FCALL                                               'var_dump'
          5        FETCH_DIM_R                                      ~5      !0, 123
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                                 
   24     8        INIT_FCALL                                               'var_dump'
          9        ASSIGN_DIM                                       ~7      !0, 123
         10        OP_DATA                                                  4
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   25    13        INIT_FCALL                                               'var_dump'
         14        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !0, 123
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
   26    17        UNSET_DIM                                                !0, 123
   28    18        ECHO                                                     '--------%0A'
   30    19        INIT_FCALL                                               'var_dump'
         20        ASSIGN                                           ~11     !1, '123'
         21        FETCH_DIM_R                                      ~12     !0, ~11
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                                 
   31    24        INIT_FCALL                                               'var_dump'
         25        ASSIGN                                           ~14     !1, '123'
         26        ASSIGN_DIM                                       ~15     !0, ~14
         27        OP_DATA                                                  4
         28        SEND_VAL                                                 ~15
         29        DO_ICALL                                                 
   32    30        INIT_FCALL                                               'var_dump'
         31        ASSIGN                                           ~17     !1, '123'
         32        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !0, ~17
         33        SEND_VAL                                                 ~18
         34        DO_ICALL                                                 
   33    35        ASSIGN                                           ~20     !1, '123'
         36        UNSET_DIM                                                !0, ~20
         37      > RETURN                                                   1

Class C:
Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MOPti
function name:  offsetGet
number of ops:  6
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ECHO                                                     'offsetGet%3A+'
    5     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    6     5      > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MOPti
function name:  offsetSet
number of ops:  7
compiled vars:  !0 = $k, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ECHO                                                     'offsetSet%3A+'
    9     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   10     6      > 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/MOPti
function name:  offsetExists
number of ops:  6
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ECHO                                                     'offsetExists%3A+'
   13     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   14     5      > 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/MOPti
function name:  offsetUnset
number of ops:  6
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ECHO                                                     'offsetUnset%3A+'
   17     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   18     5      > RETURN                                                   null

End of function offsetunset

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.12 ms | 1400 KiB | 15 Q