3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cookie implements ArrayAccess { public function offsetSet($offset, $value) { setcookie($offset, $value); } public function offsetGet($offset) { return $_COOKIE[$offset]; } } $cookie = new Cookie; // 读取Cookie print $cookie["username"]; // 写入Cookie $cookie["passwd"] = "123abc";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/goWqu
function name:  (null)
number of ops:  9
compiled vars:  !0 = $cookie
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'cookie'
   12     1        NEW                                              $1      'Cookie'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   14     4        FETCH_DIM_R                                      ~4      !0, 'username'
          5        ECHO                                                     ~4
   16     6        ASSIGN_DIM                                               !0, 'passwd'
          7        OP_DATA                                                  '123abc'
          8      > RETURN                                                   1

Class Cookie:
Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/goWqu
function name:  offsetSet
number of ops:  7
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'setcookie'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                                 
    5     6      > 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/goWqu
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_R                      global              ~1      '_COOKIE'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
    9     4*     > RETURN                                                   null

End of function offsetget

End of class Cookie.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.96 ms | 1395 KiB | 15 Q