3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (isset($_GET['cmd']) && $_GET['cmd'] == 'print'){ $list = array ( array('aaa', 'bbb', 'ccc', 'dddd'), array('123', '456', '789'), array('"aaa"', '"bbb"') ); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"example.csv\""); outputCSV($list); function outputCSV($data) { $outstream = fopen("php://output", 'w'); echo "sep=;\n"; function __outputCSV(&$vals, $key, $filehandler) { fputcsv($filehandler, $vals, ';', '"'); } array_walk($data, '__outputCSV', $outstream); fclose($outstream); } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 7
filename:       /in/FYjMM
function name:  (null)
number of ops:  20
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_IS                                         ~1      '_GET'
          1        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, 'cmd'
          2      > JMPZ_EX                                          ~2      ~2, ->7
          3    >   FETCH_R                      global              ~3      '_GET'
          4        FETCH_DIM_R                                      ~4      ~3, 'cmd'
          5        IS_EQUAL                                         ~5      ~4, 'print'
          6        BOOL                                             ~2      ~5
          7    > > JMPZ                                                     ~2, ->19
    3     8    >   ASSIGN                                                   !0, <array>
    9     9        INIT_FCALL                                               'header'
         10        SEND_VAL                                                 'Content-Type%3A+application%2Fvnd.ms-excel'
         11        DO_ICALL                                                 
   10    12        INIT_FCALL                                               'header'
         13        SEND_VAL                                                 'Content-Disposition%3A+attachment%3B+filename%3D%22example.csv%22'
         14        DO_ICALL                                                 
   11    15        INIT_FCALL_BY_NAME                                       'outputCSV'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
   13    18        DECLARE_FUNCTION                                         'outputcsv'
   24    19    > > RETURN                                                   1

Function %00outputcsv%2Fin%2FFYjMM%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYjMM
function name:  outputCSV
number of ops:  17
compiled vars:  !0 = $data, !1 = $outstream
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'php%3A%2F%2Foutput'
          3        SEND_VAL                                                 'w'
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
   15     6        ECHO                                                     'sep%3D%3B%0A'
   16     7        DECLARE_FUNCTION                                         '__outputcsv'
   19     8        INIT_FCALL                                               'array_walk'
          9        SEND_REF                                                 !0
         10        SEND_VAL                                                 '__outputCSV'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   20    13        INIT_FCALL                                               'fclose'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   21    16      > RETURN                                                   null

End of function %00outputcsv%2Fin%2FFYjMM%3A13%240

Function %00__outputcsv%2Fin%2FFYjMM%3A16%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYjMM
function name:  __outputCSV
number of ops:  10
compiled vars:  !0 = $vals, !1 = $key, !2 = $filehandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   17     3        INIT_FCALL                                               'fputcsv'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '%3B'
          7        SEND_VAL                                                 '%22'
          8        DO_ICALL                                                 
   18     9      > RETURN                                                   null

End of function %00__outputcsv%2Fin%2FFYjMM%3A16%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.34 ms | 1400 KiB | 23 Q