3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySessionHandler implements \SessionHandlerInterface { public $messages = array(); public function open($savePath, $sessionName) { $this->messages[] = 'open ' . $sessionName; } public function close() { $this->messages[] = 'close'; } public function read($id) { $this->messages[] = 'read ' . $id; } public function write($id, $data) { $this->messages[] = 'write ' . $id . ': ' . $data; } public function destroy($id) { $this->messages[] = 'destroy ' . $id; } public function gc($maxlifetime) { $this->messages[] = 'gc ' . $maxlifetime; } public function __destruct() { var_dump($this->messages); } } $handler = new MySessionHandler(); session_set_save_handler($handler, true); $_SESSION['before'] = 'start'; $handler->messages[] = var_export($_SESSION, true); session_start(); $_SESSION['foo'] = 'bar'; $handler->messages[] = session_id(); session_regenerate_id(); $handler->messages[] = session_id(); session_write_close(); session_start(); session_destroy(); $handler->messages[] = var_export($_SESSION, true); $handler->messages[] = session_id(); session_id('explicit-session-id'); session_start(); $_SESSION['john'] = 'doe';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  (null)
number of ops:  64
compiled vars:  !0 = $handler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'mysessionhandler'
   44     1        NEW                                              $1      'MySessionHandler'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   45     4        INIT_FCALL                                               'session_set_save_handler'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                                 
   47     8        FETCH_W                      global              $5      '_SESSION'
          9        ASSIGN_DIM                                               $5, 'before'
         10        OP_DATA                                                  'start'
   49    11        INIT_FCALL                                               'var_export'
         12        FETCH_R                      global              ~9      '_SESSION'
         13        SEND_VAL                                                 ~9
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $10     
         16        FETCH_OBJ_W                                      $7      !0, 'messages'
         17        ASSIGN_DIM                                               $7
         18        OP_DATA                                                  $10
   51    19        INIT_FCALL                                               'session_start'
         20        DO_ICALL                                                 
   53    21        FETCH_W                      global              $12     '_SESSION'
         22        ASSIGN_DIM                                               $12, 'foo'
         23        OP_DATA                                                  'bar'
   55    24        INIT_FCALL                                               'session_id'
         25        DO_ICALL                                         $16     
         26        FETCH_OBJ_W                                      $14     !0, 'messages'
         27        ASSIGN_DIM                                               $14
         28        OP_DATA                                                  $16
   56    29        INIT_FCALL                                               'session_regenerate_id'
         30        DO_ICALL                                                 
   57    31        INIT_FCALL                                               'session_id'
         32        DO_ICALL                                         $20     
         33        FETCH_OBJ_W                                      $18     !0, 'messages'
         34        ASSIGN_DIM                                               $18
         35        OP_DATA                                                  $20
   59    36        INIT_FCALL                                               'session_write_close'
         37        DO_ICALL                                                 
   61    38        INIT_FCALL                                               'session_start'
         39        DO_ICALL                                                 
   62    40        INIT_FCALL                                               'session_destroy'
         41        DO_ICALL                                                 
   64    42        INIT_FCALL                                               'var_export'
         43        FETCH_R                      global              ~26     '_SESSION'
         44        SEND_VAL                                                 ~26
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $27     
         47        FETCH_OBJ_W                                      $24     !0, 'messages'
         48        ASSIGN_DIM                                               $24
         49        OP_DATA                                                  $27
   65    50        INIT_FCALL                                               'session_id'
         51        DO_ICALL                                         $30     
         52        FETCH_OBJ_W                                      $28     !0, 'messages'
         53        ASSIGN_DIM                                               $28
         54        OP_DATA                                                  $30
   67    55        INIT_FCALL                                               'session_id'
         56        SEND_VAL                                                 'explicit-session-id'
         57        DO_ICALL                                                 
   68    58        INIT_FCALL                                               'session_start'
         59        DO_ICALL                                                 
   69    60        FETCH_W                      global              $33     '_SESSION'
         61        ASSIGN_DIM                                               $33, 'john'
         62        OP_DATA                                                  'doe'
         63      > RETURN                                                   1

Class MySessionHandler:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  open
number of ops:  7
compiled vars:  !0 = $savePath, !1 = $sessionName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        CONCAT                                           ~4      'open+', !1
          3        FETCH_OBJ_W                                      $2      'messages'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  ~4
   11     6      > RETURN                                                   null

End of function open

Function close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  close
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_W                                      $0      'messages'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'close'
   16     3      > RETURN                                                   null

End of function close

Function read:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  read
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        CONCAT                                           ~3      'read+', !0
          2        FETCH_OBJ_W                                      $1      'messages'
          3        ASSIGN_DIM                                               $1
          4        OP_DATA                                                  ~3
   21     5      > RETURN                                                   null

End of function read

Function write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  write
number of ops:  9
compiled vars:  !0 = $id, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        CONCAT                                           ~4      'write+', !0
          3        CONCAT                                           ~5      ~4, '%3A+'
          4        CONCAT                                           ~6      ~5, !1
          5        FETCH_OBJ_W                                      $2      'messages'
          6        ASSIGN_DIM                                               $2
          7        OP_DATA                                                  ~6
   26     8      > RETURN                                                   null

End of function write

Function destroy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  destroy
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        CONCAT                                           ~3      'destroy+', !0
          2        FETCH_OBJ_W                                      $1      'messages'
          3        ASSIGN_DIM                                               $1
          4        OP_DATA                                                  ~3
   31     5      > RETURN                                                   null

End of function destroy

Function gc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  gc
number of ops:  6
compiled vars:  !0 = $maxlifetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   35     1        CONCAT                                           ~3      'gc+', !0
          2        FETCH_OBJ_W                                      $1      'messages'
          3        ASSIGN_DIM                                               $1
          4        OP_DATA                                                  ~3
   36     5      > RETURN                                                   null

End of function gc

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fc5Pc
function name:  __destruct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'messages'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   41     4      > RETURN                                                   null

End of function __destruct

End of class MySessionHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.45 ms | 1404 KiB | 29 Q