(PHP 5 >= 5.1.0, PHP 7, PHP 8)
The SplFileObject class offers an object-oriented interface for a file.
$filename,$mode = "r",$useIncludePath = false,$context = nullsince: '8.6')]$separator = ",", string $enclosure = "\"", string $escape = "\\"): array|falsesince: '8.6')]$fields,$separator = ",",$enclosure = "\"",$escape = "\\",$eol = "\n"since: '8.6')]$separator = ",", string $enclosure = "\"", string $escape = "\\"): void$mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObjectDrop newlines at the end of a line.
Read on rewind/next.
Skips empty lines in the file. This requires the READ_AHEAD flag be enabled, to work as expected.
Read lines as CSV rows.
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |