3v4l.org

run code in 300+ PHP versions simultaneously
<?php $handle = fopen('/tmp/file', 'w+'); // truncate + attempt to create fwrite($handle, '12345'); // file position > 0 rewind($handle); // position = 0 $content = stream_get_contents($handle); // file position = 0 in PHP 5.1.6, file position > 0 in PHP 5.2.17! fwrite($handle, '6789'); fclose($handle); echo $content;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OQdDa
function name:  (null)
number of ops:  25
compiled vars:  !0 = $handle, !1 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 '%2Ftmp%2Ffile'
          2        SEND_VAL                                                 'w%2B'
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    4     5        INIT_FCALL                                               'fwrite'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 '12345'
          8        DO_ICALL                                                 
    5     9        INIT_FCALL                                               'rewind'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
    6    12        INIT_FCALL                                               'stream_get_contents'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        ASSIGN                                                   !1, $6
    7    16        INIT_FCALL                                               'fwrite'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 '6789'
         19        DO_ICALL                                                 
    8    20        INIT_FCALL                                               'fclose'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
    9    23        ECHO                                                     !1
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.13 ms | 1395 KiB | 23 Q