(PHP 5 >= 5.1.0, PHP 7, PHP 8)
The SplFileObject class offers an object-oriented interface for a file.
$filename
$mode
$useIncludePath
false
$context
null
$separator
$enclosure
$escape
$allowable_tags
$operation
&$wouldBlock
$fields
$eol
$length
$format
&...$vars
$offset
$whence
SEEK_SET
$size
$data
$line
$flags
$maxLength
$suffix
$class
SplFileObject::class
SplFileInfo::class
SplFileObject::DROP_NEW_LINE
Drop newlines at the end of a line.
SplFileObject::READ_AHEAD
Read on rewind/next.
SplFileObject::SKIP_EMPTY
Skips empty lines in the file. This requires the READ_AHEAD flag be enabled, to work as expected.
READ_AHEAD
SplFileObject::READ_CSV
Read lines as CSV rows.