3v4l.org

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

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rbq9o
function name:  test
number of ops:  52
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'fwrite'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                                 
    4     8        INIT_FCALL                                               'fseek'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 0
         11        DO_ICALL                                                 
    5    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'fwrite'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 '1234567890'
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                                 
    6    19        INIT_FCALL                                               'fseek'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 0
         22        DO_ICALL                                                 
    7    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'fread'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 10
         27        DO_ICALL                                         $7      
         28        SEND_VAR                                                 $7
         29        DO_ICALL                                                 
    8    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'fread'
         32        SEND_VAR                                                 !0
         33        SEND_VAL                                                 10
         34        DO_ICALL                                         $9      
         35        SEND_VAR                                                 $9
         36        DO_ICALL                                                 
    9    37        INIT_FCALL                                               'var_dump'
         38        INIT_FCALL                                               'fread'
         39        SEND_VAR                                                 !0
         40        SEND_VAL                                                 10
         41        DO_ICALL                                         $11     
         42        SEND_VAR                                                 $11
         43        DO_ICALL                                                 
   10    44        INIT_FCALL                                               'var_dump'
         45        INIT_FCALL                                               'fread'
         46        SEND_VAR                                                 !0
         47        SEND_VAL                                                 10
         48        DO_ICALL                                         $13     
         49        SEND_VAR                                                 $13
         50        DO_ICALL                                                 
   11    51      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.53 ms | 1403 KiB | 27 Q