3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Speedy yet memory intensive version $f = fopen('php://memory', 'w+'); foreach($data_source as $row) { // You may configure fputcsv as usual fputcsv($f, $row); } rewind($f); // Important $fp = fopen('final.csv', 'w+'); fputs($fp, stream_get_contents($f)); fclose($fp); fclose($f); // Slower version $fp = fopen('final.csv', 'w+'); foreach($data_source as $row) { // You may configure fputcsv as usual fputcsv($fp, $row); } fclose($fp); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 46
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 12
filename:       /in/8ei2U
function name:  (null)
number of ops:  51
compiled vars:  !0 = $f, !1 = $data_source, !2 = $row, !3 = $fp
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                                                     'w%2B'
          3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !0, $4
    5     5      > FE_RESET_R                                           $6      !1, ->12
          6    > > FE_FETCH_R                                                   $6, !2, ->12
    7     7    >   INIT_FCALL                                                   'fputcsv'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !2
         10        DO_ICALL                                                     
    5    11      > JMP                                                          ->6
         12    >   FE_FREE                                                      $6
    9    13        INIT_FCALL                                                   'rewind'
         14        SEND_VAR                                                     !0
         15        DO_ICALL                                                     
   10    16        INIT_FCALL                                                   'fopen'
         17        SEND_VAL                                                     'final.csv'
         18        SEND_VAL                                                     'w%2B'
         19        DO_ICALL                                             $9      
         20        ASSIGN                                                       !3, $9
   11    21        INIT_FCALL                                                   'fputs'
         22        SEND_VAR                                                     !3
         23        INIT_FCALL                                                   'stream_get_contents'
         24        SEND_VAR                                                     !0
         25        DO_ICALL                                             $11     
         26        SEND_VAR                                                     $11
         27        DO_ICALL                                                     
   12    28        INIT_FCALL                                                   'fclose'
         29        SEND_VAR                                                     !3
         30        DO_ICALL                                                     
   13    31        INIT_FCALL                                                   'fclose'
         32        SEND_VAR                                                     !0
         33        DO_ICALL                                                     
   16    34        INIT_FCALL                                                   'fopen'
         35        SEND_VAL                                                     'final.csv'
         36        SEND_VAL                                                     'w%2B'
         37        DO_ICALL                                             $15     
         38        ASSIGN                                                       !3, $15
   17    39      > FE_RESET_R                                           $17     !1, ->46
         40    > > FE_FETCH_R                                                   $17, !2, ->46
   19    41    >   INIT_FCALL                                                   'fputcsv'
         42        SEND_VAR                                                     !3
         43        SEND_VAR                                                     !2
         44        DO_ICALL                                                     
   17    45      > JMP                                                          ->40
         46    >   FE_FREE                                                      $17
   21    47        INIT_FCALL                                                   'fclose'
         48        SEND_VAR                                                     !3
         49        DO_ICALL                                                     
   22    50      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
149.98 ms | 1154 KiB | 19 Q