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(); $k = '123'; 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/r1UOj
function name:  (null)
number of ops:  24
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
   21     4        ASSIGN                                                   !1, '123'
   22     5        INIT_FCALL                                               'var_dump'
          6        ASSIGN                                           ~6      !1, '123'
          7        FETCH_DIM_R                                      ~7      !0, ~6
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                                 
   23    10        INIT_FCALL                                               'var_dump'
         11        ASSIGN                                           ~9      !1, '123'
         12        ASSIGN_DIM                                       ~10     !0, ~9
         13        OP_DATA                                                  4
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                                 
   24    16        INIT_FCALL                                               'var_dump'
         17        ASSIGN                                           ~12     !1, '123'
         18        ISSET_ISEMPTY_DIM_OBJ                         0  ~13     !0, ~12
         19        SEND_VAL                                                 ~13
         20        DO_ICALL                                                 
   25    21        ASSIGN                                           ~15     !1, '123'
         22        UNSET_DIM                                                !0, ~15
         23      > RETURN                                                   1

Class C:
Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1UOj
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/r1UOj
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/r1UOj
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/r1UOj
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:
145.84 ms | 1400 KiB | 15 Q