3v4l.org

run code in 300+ 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; } }
Output for 8.4.1 - 8.4.14, 8.5.0
Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18 Deprecated: SplFileObject::fgetcsv(): the $escape parameter must be provided, as its default value will change, either explicitly or via SplFileObject::setCsvControl() in /in/6dQTT on line 18
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
READ_AHEAD flag makes fgetcsv return NULL SKIP_EMPTY flag makes fgetcsv return NULL READ_AHEAD-DROP_NEW_LINE flag makes fgetcsv return NULL READ_AHEAD-SKIP_EMPTY flag makes fgetcsv return NULL DROP_NEW_LINE-SKIP_EMPTY flag makes fgetcsv return NULL READ_AHEAD-SKIP_EMPTY-DROP_NEW_LINE flag makes fgetcsv return NULL

preferences:
95.32 ms | 413 KiB | 5 Q