3v4l.org

run code in 300+ PHP versions simultaneously
<?php class VariableStream { var $position; var $varname; function stream_open($path, $mode, $options, &$opened_path) { echo "openingt n"; $url = parse_url($path); $this->varname = $url["host"]; $this->position = 0; return true; } function stream_read($count) { echo "reading\n"; $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } function stream_eof() { echo "eoffing\n"; return $this->position >= strlen($GLOBALS[$this->varname]); } function stream_stat() { echo "stating\n"; $time = time(); return array( 0, // device number 0, // inode number 0, // inode protection mode 0, // number of links 0, // userid of owner 0, // groupid of owner 0, // device type, if inode device strlen($GLOBALS[$this->varname]), // size in bytes $time, // atime - time of last access $time, // mtime - time of last modification $time, // ctime - time of creation -1, // block size of filesystem I/O -1 // number of 512-byte blocks allocated ); } } stream_wrapper_register("var", "VariableStream"); $myvar = "fooey"; $v = include 'var://myvar'; var_dump($v);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YRUCv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $myvar, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   INIT_FCALL                                               'stream_wrapper_register'
          1        SEND_VAL                                                 'var'
          2        SEND_VAL                                                 'VariableStream'
          3        DO_ICALL                                                 
   50     4        ASSIGN                                                   !0, 'fooey'
   52     5        INCLUDE_OR_EVAL                                  $4      'var%3A%2F%2Fmyvar', INCLUDE
          6        ASSIGN                                                   !1, $4
   53     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class VariableStream:
Function stream_open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YRUCv
function name:  stream_open
number of ops:  16
compiled vars:  !0 = $path, !1 = $mode, !2 = $options, !3 = $opened_path, !4 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    8     4        ECHO                                                     'openingt++++n'
    9     5        INIT_FCALL                                               'parse_url'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !4, $5
   10     9        FETCH_DIM_R                                      ~8      !4, 'host'
         10        ASSIGN_OBJ                                               'varname'
         11        OP_DATA                                                  ~8
   11    12        ASSIGN_OBJ                                               'position'
         13        OP_DATA                                                  0
   12    14      > RETURN                                                   <true>
   13    15*     > RETURN                                                   null

End of function stream_open

Function stream_read:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YRUCv
function name:  stream_read
number of ops:  17
compiled vars:  !0 = $count, !1 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ECHO                                                     'reading%0A'
   17     2        INIT_FCALL                                               'substr'
          3        FETCH_OBJ_R                                      ~3      'varname'
          4        FETCH_R                      global              ~2      'GLOBALS'
          5        FETCH_DIM_R                                      ~4      ~2, ~3
          6        SEND_VAL                                                 ~4
          7        FETCH_OBJ_R                                      ~5      'position'
          8        SEND_VAL                                                 ~5
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !1, $6
   18    12        STRLEN                                           ~9      !1
         13        ASSIGN_OBJ_OP                                 1          'position'
         14        OP_DATA                                                  ~9
   19    15      > RETURN                                                   !1
   20    16*     > RETURN                                                   null

End of function stream_read

Function stream_eof:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YRUCv
function name:  stream_eof
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                     'eoffing%0A'
   24     1        FETCH_OBJ_R                                      ~0      'position'
          2        FETCH_OBJ_R                                      ~2      'varname'
          3        FETCH_R                      global              ~1      'GLOBALS'
          4        FETCH_DIM_R                                      ~3      ~1, ~2
          5        STRLEN                                           ~4      ~3
          6        IS_SMALLER_OR_EQUAL                              ~5      ~4, ~0
          7      > RETURN                                                   ~5
   25     8*     > RETURN                                                   null

End of function stream_eof

Function stream_stat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YRUCv
function name:  stream_stat
number of ops:  23
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'stating%0A'
   29     1        INIT_FCALL                                               'time'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
   31     4        INIT_ARRAY                                       ~3      0
   32     5        ADD_ARRAY_ELEMENT                                ~3      0
   33     6        ADD_ARRAY_ELEMENT                                ~3      0
   34     7        ADD_ARRAY_ELEMENT                                ~3      0
   35     8        ADD_ARRAY_ELEMENT                                ~3      0
   36     9        ADD_ARRAY_ELEMENT                                ~3      0
   37    10        ADD_ARRAY_ELEMENT                                ~3      0
   38    11        FETCH_OBJ_R                                      ~5      'varname'
         12        FETCH_R                      global              ~4      'GLOBALS'
         13        FETCH_DIM_R                                      ~6      ~4, ~5
         14        STRLEN                                           ~7      ~6
         15        ADD_ARRAY_ELEMENT                                ~3      ~7
   39    16        ADD_ARRAY_ELEMENT                                ~3      !0
   40    17        ADD_ARRAY_ELEMENT                                ~3      !0
   41    18        ADD_ARRAY_ELEMENT                                ~3      !0
   31    19        ADD_ARRAY_ELEMENT                                ~3      -1
         20        ADD_ARRAY_ELEMENT                                ~3      -1
         21      > RETURN                                                   ~3
   45    22*     > RETURN                                                   null

End of function stream_stat

End of class VariableStream.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.95 ms | 1404 KiB | 23 Q