3v4l.org

run code in 500+ PHP versions simultaneously
<?php $flagList = [ 'DROP_NEW_LINE' => SplFileObject::DROP_NEW_LINE, 'READ_AHEAD' => SplFileObject::READ_AHEAD, 'SKIP_EMPTY' => SplFileObject::SKIP_EMPTY, 'READ_AHEAD-DROP_NEW_LINE' => SplFileObject::READ_AHEAD | SplFileObject::DROP_NEW_LINE, 'READ_AHEAD-SKIP_EMPTY' => SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY, 'DROP_NEW_LINE-SKIP_EMPTY' => SplFileObject::DROP_NEW_LINE | SplFileObject::SKIP_EMPTY, 'READ_AHEAD-SKIP_EMPTY-DROP_NEW_LINE' => SplFileObject::READ_AHEAD | SplFileObject::DROP_NEW_LINE | SplFileObject::SKIP_EMPTY, ]; $file = new SplFileObject('/tmp/test.csv', 'w+'); $file->fwrite("1st\n\n2nd\n"); foreach ($flagList as $type => $flag) { $file->setFlags(SplFileObject::READ_CSV | $flag); if ($file->fgetcsv() === null) { echo $type . ' flag makes fgetcsv return NULL' . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 24
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/6dQTT
function name:  (null)
number of ops:  26
compiled vars:  !0 = $flagList, !1 = $file, !2 = $flag, !3 = $type
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   13     1        NEW                                                  $5      'SplFileObject'
          2        SEND_VAL_EX                                                  '%2Ftmp%2Ftest.csv'
          3        SEND_VAL_EX                                                  'w%2B'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   14     6        INIT_METHOD_CALL                                             !1, 'fwrite'
          7        SEND_VAL_EX                                                  '1st%0A%0A2nd%0A'
          8        DO_FCALL                                          0          
   16     9      > FE_RESET_R                                           $9      !0, ->24
         10    > > FE_FETCH_R                                           ~10     $9, !2, ->24
         11    >   ASSIGN                                                       !3, ~10
   17    12        INIT_METHOD_CALL                                             !1, 'setFlags'
         13        BW_OR                                                ~12     !2, 8
         14        SEND_VAL_EX                                                  ~12
         15        DO_FCALL                                          0          
   18    16        INIT_METHOD_CALL                                             !1, 'fgetcsv'
         17        DO_FCALL                                          0  $14     
         18        TYPE_CHECK                                        2          $14
         19      > JMPZ                                                         ~15, ->23
   19    20    >   CONCAT                                               ~16     !3, '+flag+makes+fgetcsv+return+NULL'
         21        CONCAT                                               ~17     ~16, '%0A'
         22        ECHO                                                         ~17
   16    23    > > JMP                                                          ->10
         24    >   FE_FREE                                                      $9
   21    25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.87 ms | 2053 KiB | 13 Q