3v4l.org

run code in 500+ PHP versions simultaneously
<?php function test($a) { fwrite($a, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); fseek($a, 0); fwrite($a, '1234567890'); fseek($a, 0); var_dump(fread($a, 1024)); fclose($a); } $a = fopen('php://temp', 'a+'); test($a); echo '-------------------' . PHP_EOL; $a = fopen(tempnam(sys_get_temp_dir(), 'hello'), 'a+'); test($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sqb9f
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                                   'fopen'
          1        SEND_VAL                                                     'php%3A%2F%2Ftemp'
          2        SEND_VAL                                                     'a%2B'
          3        DO_ICALL                                             $1      
          4        ASSIGN                                                       !0, $1
   12     5        INIT_FCALL                                                   'test'
          6        SEND_VAR                                                     !0
          7        DO_FCALL                                          0          
   14     8        ECHO                                                         '-------------------%0A'
   16     9        INIT_FCALL                                                   'fopen'
         10        INIT_FCALL                                                   'tempnam'
         11        INIT_FCALL                                                   'sys_get_temp_dir'
         12        DO_ICALL                                             $4      
         13        SEND_VAR                                                     $4
         14        SEND_VAL                                                     'hello'
         15        DO_ICALL                                             $5      
         16        SEND_VAR                                                     $5
         17        SEND_VAL                                                     'a%2B'
         18        DO_ICALL                                             $6      
         19        ASSIGN                                                       !0, $6
   17    20        INIT_FCALL                                                   'test'
         21        SEND_VAR                                                     !0
         22        DO_FCALL                                          0          
         23      > RETURN                                                       1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sqb9f
function name:  test
number of ops:  28
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        INIT_FCALL                                                   'fwrite'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
          4        DO_ICALL                                                     
    4     5        INIT_FCALL                                                   'fseek'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     0
          8        DO_ICALL                                                     
    5     9        INIT_FCALL                                                   'fwrite'
         10        SEND_VAR                                                     !0
         11        SEND_VAL                                                     '1234567890'
         12        DO_ICALL                                                     
    6    13        INIT_FCALL                                                   'fseek'
         14        SEND_VAR                                                     !0
         15        SEND_VAL                                                     0
         16        DO_ICALL                                                     
    7    17        INIT_FCALL                                                   'var_dump'
         18        INIT_FCALL                                                   'fread'
         19        SEND_VAR                                                     !0
         20        SEND_VAL                                                     1024
         21        DO_ICALL                                             $5      
         22        SEND_VAR                                                     $5
         23        DO_ICALL                                                     
    8    24        INIT_FCALL                                                   'fclose'
         25        SEND_VAR                                                     !0
         26        DO_ICALL                                                     
    9    27      > RETURN                                                       null

End of function test

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.83 ms | 2220 KiB | 23 Q