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 . "\n"; } public function close() { $this->messages[] = 'close' . "\n"; } public function read($id) { $this->messages[] = 'read ' . $id . "\n"; } public function write($id, $data) { $this->messages[] = 'write ' . $id . ': ' . $data . "\n"; } public function destroy($id) { $this->messages[] = 'destroy ' . $id . "\n"; } public function gc($maxlifetime) { $this->messages[] = 'gc ' . $maxlifetime . "\n"; } } $handler = new MySessionHandler(); session_set_save_handler($handler, true); session_start(); $_SESSION['foo'] = 'bar'; $handler->messages[] = session_id() . "\n"; session_regenerate_id(); $handler->messages[] = session_id() . "\n"; session_destroy(); session_start(); session_write_close(); var_dump($handler->messages);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nJ08J
function name:  (null)
number of ops:  38
compiled vars:  !0 = $handler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'mysessionhandler'
   39     1        NEW                                              $1      'MySessionHandler'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   40     4        INIT_FCALL                                               'session_set_save_handler'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                                 
   41     8        INIT_FCALL                                               'session_start'
          9        DO_ICALL                                                 
   43    10        FETCH_W                      global              $6      '_SESSION'
         11        ASSIGN_DIM                                               $6, 'foo'
         12        OP_DATA                                                  'bar'
   45    13        INIT_FCALL                                               'session_id'
         14        DO_ICALL                                         $10     
         15        CONCAT                                           ~11     $10, '%0A'
         16        FETCH_OBJ_W                                      $8      !0, 'messages'
         17        ASSIGN_DIM                                               $8
         18        OP_DATA                                                  ~11
   46    19        INIT_FCALL                                               'session_regenerate_id'
         20        DO_ICALL                                                 
   47    21        INIT_FCALL                                               'session_id'
         22        DO_ICALL                                         $15     
         23        CONCAT                                           ~16     $15, '%0A'
         24        FETCH_OBJ_W                                      $13     !0, 'messages'
         25        ASSIGN_DIM                                               $13
         26        OP_DATA                                                  ~16
   48    27        INIT_FCALL                                               'session_destroy'
         28        DO_ICALL                                                 
   50    29        INIT_FCALL                                               'session_start'
         30        DO_ICALL                                                 
   51    31        INIT_FCALL                                               'session_write_close'
         32        DO_ICALL                                                 
   53    33        INIT_FCALL                                               'var_dump'
         34        FETCH_OBJ_R                                      ~20     !0, 'messages'
         35        SEND_VAL                                                 ~20
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Class MySessionHandler:
Function open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nJ08J
function name:  open
number of ops:  8
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        CONCAT                                           ~5      ~4, '%0A'
          4        FETCH_OBJ_W                                      $2      'messages'
          5        ASSIGN_DIM                                               $2
          6        OP_DATA                                                  ~5
   11     7      > 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/nJ08J
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%0A'
   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/nJ08J
function name:  read
number of ops:  7
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        CONCAT                                           ~4      ~3, '%0A'
          3        FETCH_OBJ_W                                      $1      'messages'
          4        ASSIGN_DIM                                               $1
          5        OP_DATA                                                  ~4
   21     6      > 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/nJ08J
function name:  write
number of ops:  10
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        CONCAT                                           ~7      ~6, '%0A'
          6        FETCH_OBJ_W                                      $2      'messages'
          7        ASSIGN_DIM                                               $2
          8        OP_DATA                                                  ~7
   26     9      > 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/nJ08J
function name:  destroy
number of ops:  7
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        CONCAT                                           ~4      ~3, '%0A'
          3        FETCH_OBJ_W                                      $1      'messages'
          4        ASSIGN_DIM                                               $1
          5        OP_DATA                                                  ~4
   31     6      > 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/nJ08J
function name:  gc
number of ops:  7
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        CONCAT                                           ~4      ~3, '%0A'
          3        FETCH_OBJ_W                                      $1      'messages'
          4        ASSIGN_DIM                                               $1
          5        OP_DATA                                                  ~4
   36     6      > RETURN                                                   null

End of function gc

End of class MySessionHandler.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.89 ms | 1404 KiB | 27 Q