3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = date('dmY-His'); header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=visitors-$file.csv"); header("Pragma: no-cache"); header("Expires: 0"); $sql = "select id, ip, server, time, date from visitors"; $res = mysql_query($sql); $data = array(); $data[] = array('id', 'ip', 'server', 'time', 'date'); while ($row = mysql_fetch_array($res)) { $data[] = array_values($row); } $output = fopen("php://output", "w"); foreach ($data as $val) { fputcsv($output, $val); } fclose($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 28
Branch analysis from position: 38
2 jumps found. (Code = 77) Position 1 = 44, Position 2 = 50
Branch analysis from position: 44
2 jumps found. (Code = 78) Position 1 = 45, Position 2 = 50
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 28
Branch analysis from position: 38
Branch analysis from position: 28
filename:       /in/MmkMW
function name:  (null)
number of ops:  55
compiled vars:  !0 = $file, !1 = $sql, !2 = $res, !3 = $data, !4 = $row, !5 = $output, !6 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'dmY-His'
          2        DO_ICALL                                         $7      
          3        ASSIGN                                                   !0, $7
    4     4        INIT_FCALL                                               'header'
          5        SEND_VAL                                                 'Content-type%3A+text%2Fcsv'
          6        DO_ICALL                                                 
    5     7        INIT_FCALL                                               'header'
          8        ROPE_INIT                                     3  ~11     'Content-Disposition%3A+attachment%3B+filename%3Dvisitors-'
          9        ROPE_ADD                                      1  ~11     ~11, !0
         10        ROPE_END                                      2  ~10     ~11, '.csv'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
    6    13        INIT_FCALL                                               'header'
         14        SEND_VAL                                                 'Pragma%3A+no-cache'
         15        DO_ICALL                                                 
    7    16        INIT_FCALL                                               'header'
         17        SEND_VAL                                                 'Expires%3A+0'
         18        DO_ICALL                                                 
    8    19        ASSIGN                                                   !1, 'select+id%2C+ip%2C+server%2C+time%2C+date+from+visitors'
    9    20        INIT_FCALL_BY_NAME                                       'mysql_query'
         21        SEND_VAR_EX                                              !1
         22        DO_FCALL                                      0  $17     
         23        ASSIGN                                                   !2, $17
   10    24        ASSIGN                                                   !3, <array>
   11    25        ASSIGN_DIM                                               !3
         26        OP_DATA                                                  <array>
   12    27      > JMP                                                      ->33
   13    28    >   INIT_FCALL                                               'array_values'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $22     
         31        ASSIGN_DIM                                               !3
         32        OP_DATA                                                  $22
   12    33    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_array'
         34        SEND_VAR_EX                                              !2
         35        DO_FCALL                                      0  $23     
         36        ASSIGN                                           ~24     !4, $23
         37      > JMPNZ                                                    ~24, ->28
   16    38    >   INIT_FCALL                                               'fopen'
         39        SEND_VAL                                                 'php%3A%2F%2Foutput'
         40        SEND_VAL                                                 'w'
         41        DO_ICALL                                         $25     
         42        ASSIGN                                                   !5, $25
   17    43      > FE_RESET_R                                       $27     !3, ->50
         44    > > FE_FETCH_R                                               $27, !6, ->50
   18    45    >   INIT_FCALL                                               'fputcsv'
         46        SEND_VAR                                                 !5
         47        SEND_VAR                                                 !6
         48        DO_ICALL                                                 
   17    49      > JMP                                                      ->44
         50    >   FE_FREE                                                  $27
   20    51        INIT_FCALL                                               'fclose'
         52        SEND_VAR                                                 !5
         53        DO_ICALL                                                 
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.7 ms | 1400 KiB | 25 Q