3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MemoryFile { private static $data = ""; private static $pos = 0; public function stream_open() { self::$pos = 0; return true; } public function stream_read($count) { return substr(self::$data, (self::$pos += $count) - $count, $count); } public function stream_write($data) { self::$data = substr(self::$data, 0, self::$pos) . $data; self::$pos += strlen($data); return strlen($data); } public function stream_tell() { return self::$pos; } public function stream_eof() { return self::$pos >= strlen(self::$data); } public function stream_stat() { return []; } } stream_wrapper_register("foo", "MemoryFile"); file_put_contents("foo://bar", <<<'PHTML' <?php // view.phtml echo "<html><head><title>$this->data</title></head><body></body></html>"; PHTML ); // View.php class View { private $data = 'test'; public function render() { require 'foo://bar'; } } (new View)->render();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                                   'stream_wrapper_register'
          1        SEND_VAL                                                     'foo'
          2        SEND_VAL                                                     'MemoryFile'
          3        DO_ICALL                                                     
   16     4        INIT_FCALL                                                   'file_put_contents'
          5        SEND_VAL                                                     'foo%3A%2F%2Fbar'
   18     6        SEND_VAL                                                     '%3C%3Fphp%0A%0A%2F%2F+view.phtml%0Aecho+%22%3Chtml%3E%3Chead%3E%3Ctitle%3E%24this-%3Edata%3C%2Ftitle%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E%22%3B'
   16     7        DO_ICALL                                                     
   32     8        NEW                                                  $2      'View'
          9        DO_FCALL                                          0          
         10        INIT_METHOD_CALL                                             $2, 'render'
         11        DO_FCALL                                          0          
         12      > RETURN                                                       1

Class MemoryFile:
Function stream_open:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  stream_open
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   ASSIGN_STATIC_PROP                                           'pos'
          1        OP_DATA                                                      0
          2      > RETURN                                                       <true>
          3*     > 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/Qv730
function name:  stream_read
number of ops:  9
compiled vars:  !0 = $count
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        FETCH_STATIC_PROP_R              unknown             ~1      'data'
          2        ASSIGN_STATIC_PROP_OP                             1  ~2      'pos'
          3        OP_DATA                                                      !0
          4        SUB                                                  ~3      ~2, !0
          5        FRAMELESS_ICALL_3                substr              ~4      ~1, ~3
          6        OP_DATA                                                      !0
          7      > RETURN                                                       ~4
          8*     > RETURN                                                       null

End of function stream_read

Function stream_write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  stream_write
number of ops:  14
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        FETCH_STATIC_PROP_R              unknown             ~2      'data'
          2        FETCH_STATIC_PROP_R              unknown             ~3      'pos'
          3        FRAMELESS_ICALL_3                substr              ~4      ~2, 0
          4        OP_DATA                                                      ~3
          5        CONCAT                                               ~5      ~4, !0
          6        ASSIGN_STATIC_PROP                                           'data'
          7        OP_DATA                                                      ~5
          8        STRLEN                                               ~7      !0
          9        ASSIGN_STATIC_PROP_OP                             1          'pos'
         10        OP_DATA                                                      ~7
         11        STRLEN                                               ~8      !0
         12      > RETURN                                                       ~8
         13*     > RETURN                                                       null

End of function stream_write

Function stream_tell:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  stream_tell
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R              unknown             ~0      'pos'
          1      > RETURN                                                       ~0
          2*     > RETURN                                                       null

End of function stream_tell

Function stream_eof:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  stream_eof
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   FETCH_STATIC_PROP_R              unknown             ~0      'pos'
          1        FETCH_STATIC_PROP_R              unknown             ~1      'data'
          2        STRLEN                                               ~2      ~1
          3        IS_SMALLER_OR_EQUAL                                  ~3      ~2, ~0
          4      > RETURN                                                       ~3
          5*     > 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/Qv730
function name:  stream_stat
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                       <array>
          1*     > RETURN                                                       null

End of function stream_stat

End of class MemoryFile.

Class View:
Function render:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qv730
function name:  render
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   INCLUDE_OR_EVAL                                              'foo%3A%2F%2Fbar', REQUIRE
   30     1      > RETURN                                                       null

End of function render

End of class View.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
215.67 ms | 1661 KiB | 10 Q