3v4l.org

run code in 500+ PHP versions simultaneously
<?php // build something entirely in memory... $fp = fopen('php://memory', 'r+'); fputcsv($fp, ['name', 'email', 'role']); fputcsv($fp, ['Alex', 'alex@example.com', 'CTO']); fputcsv($fp, ['Jane', 'jane@example.com', 'Dev']); rewind($fp); $csv = stream_get_contents($fp); fclose($fp); // send as download header('Content-Type: text/csv'); echo $csv; // php://temp, same but spills to disk over 2MB... or more! $fp = fopen('php://temp/maxmemory:8388608', 'r+'); // 8MB in RAM, then auto-swaps to a temp file // no gc, no unlink(), no /tmp pollution // the stream disappears when $fp is closed
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFBcn
function name:  (null)
number of ops:  37
compiled vars:  !0 = $fp, !1 = $csv
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                                   'fopen'
          1        SEND_VAL                                                     'php%3A%2F%2Fmemory'
          2        SEND_VAL                                                     'r%2B'
          3        DO_ICALL                                             $2      
          4        ASSIGN                                                       !0, $2
    5     5        INIT_FCALL                                                   'fputcsv'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     <array>
          8        DO_ICALL                                                     
    6     9        INIT_FCALL                                                   'fputcsv'
         10        SEND_VAR                                                     !0
         11        SEND_VAL                                                     <array>
         12        DO_ICALL                                                     
    7    13        INIT_FCALL                                                   'fputcsv'
         14        SEND_VAR                                                     !0
         15        SEND_VAL                                                     <array>
         16        DO_ICALL                                                     
    9    17        INIT_FCALL                                                   'rewind'
         18        SEND_VAR                                                     !0
         19        DO_ICALL                                                     
   10    20        INIT_FCALL                                                   'stream_get_contents'
         21        SEND_VAR                                                     !0
         22        DO_ICALL                                             $8      
         23        ASSIGN                                                       !1, $8
   11    24        INIT_FCALL                                                   'fclose'
         25        SEND_VAR                                                     !0
         26        DO_ICALL                                                     
   14    27        INIT_FCALL                                                   'header'
         28        SEND_VAL                                                     'Content-Type%3A+text%2Fcsv'
         29        DO_ICALL                                                     
   15    30        ECHO                                                         !1
   18    31        INIT_FCALL                                                   'fopen'
         32        SEND_VAL                                                     'php%3A%2F%2Ftemp%2Fmaxmemory%3A8388608'
         33        SEND_VAL                                                     'r%2B'
         34        DO_ICALL                                             $12     
         35        ASSIGN                                                       !0, $12
   22    36      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
139.79 ms | 1149 KiB | 19 Q