3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fp = fopen('test.txt', 'a+'); fwrite($fp, 'foo'); echo ftell($fp); fseek($fp, 0); fwrite($fp, 'bar'); echo ftell($fp); echo fread($fp, 3); fseek($fp, 0); echo fread($fp, 6);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CfPV9
function name:  (null)
number of ops:  40
compiled vars:  !0 = $fp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 'test.txt'
          2        SEND_VAL                                                 'a%2B'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
    4     5        INIT_FCALL                                               'fwrite'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'foo'
          8        DO_ICALL                                                 
    5     9        INIT_FCALL                                               'ftell'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $4      
         12        ECHO                                                     $4
    6    13        INIT_FCALL                                               'fseek'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 0
         16        DO_ICALL                                                 
    7    17        INIT_FCALL                                               'fwrite'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 'bar'
         20        DO_ICALL                                                 
    8    21        INIT_FCALL                                               'ftell'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $7      
         24        ECHO                                                     $7
    9    25        INIT_FCALL                                               'fread'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 3
         28        DO_ICALL                                         $8      
         29        ECHO                                                     $8
   10    30        INIT_FCALL                                               'fseek'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 0
         33        DO_ICALL                                                 
   11    34        INIT_FCALL                                               'fread'
         35        SEND_VAR                                                 !0
         36        SEND_VAL                                                 6
         37        DO_ICALL                                         $10     
         38        ECHO                                                     $10
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.39 ms | 1396 KiB | 23 Q