3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = tempnam(sys_get_temp_dir(), "csv"); $csv = <<<CSV "foo\n\nbar\nbaz",qux "foo\nbar\nbaz",qux CSV; file_put_contents($filename, $csv); $file = new SplFileObject($filename); // $file->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE | SplFileObject::READ_CSV); $file->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); // var_dump(iterator_to_array($file)); while (($record = $file->fgetcsv())) { var_dump($record); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 20
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 20
Branch analysis from position: 27
Branch analysis from position: 20
filename:       /in/OEiFq
function name:  (null)
number of ops:  28
compiled vars:  !0 = $filename, !1 = $csv, !2 = $file, !3 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'tempnam'
          1        INIT_FCALL                                               'sys_get_temp_dir'
          2        DO_ICALL                                         $4      
          3        SEND_VAR                                                 $4
          4        SEND_VAL                                                 'csv'
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !0, $5
    4     7        ASSIGN                                                   !1, '%22foo%0A%0Abar%0Abaz%22%2Cqux%0A%0A%22foo%0Abar%0Abaz%22%2Cqux'
   10     8        INIT_FCALL                                               'file_put_contents'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   12    12        NEW                                              $9      'SplFileObject'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !2, $9
   15    16        INIT_METHOD_CALL                                         !2, 'setFlags'
         17        SEND_VAL_EX                                              5
         18        DO_FCALL                                      0          
   18    19      > JMP                                                      ->23
   19    20    >   INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   18    23    >   INIT_METHOD_CALL                                         !2, 'fgetcsv'
         24        DO_FCALL                                      0  $14     
         25        ASSIGN                                           ~15     !3, $14
         26      > JMPNZ                                                    ~15, ->20
   20    27    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.22 ms | 1085 KiB | 17 Q