3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = fopen('php://memory', 'w+'); fwrite($f, 'Hello'); ftruncate($f, 2); // in 7.3 changes file pointer to 2 fwrite($f, 'World'); rewind($f); echo addslashes(stream_get_contents($f)); fclose($f);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hXXDr
function name:  (null)
number of ops:  31
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          2        SEND_VAL                                                 'w%2B'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
    4     5        INIT_FCALL                                               'fwrite'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'Hello'
          8        DO_ICALL                                                 
    5     9        INIT_FCALL                                               'ftruncate'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 2
         12        DO_ICALL                                                 
    6    13        INIT_FCALL                                               'fwrite'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 'World'
         16        DO_ICALL                                                 
    7    17        INIT_FCALL                                               'rewind'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
    8    20        INIT_FCALL                                               'addslashes'
         21        INIT_FCALL                                               'stream_get_contents'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $7      
         24        SEND_VAR                                                 $7
         25        DO_ICALL                                         $8      
         26        ECHO                                                     $8
    9    27        INIT_FCALL                                               'fclose'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.63 ms | 1395 KiB | 27 Q