| Defined | src/filesystem/linesofalarge/LinesOfALargeFile.php:21 |
|---|---|
| Group | Filesystem |
| Extends | LinesOfALarge |
Read the lines of a file, one at a time. This allows you to process large files without holding them in memory. In most cases, it is more efficient (and certainly simpler) to read the entire file and explode() it. For more information, see LinesOfALarge. See also LinesOfALargeExecFuture, for a similar abstraction that works on executed commands.
foreach (new LinesOfALargeFile('/some/large/logfile.log') as $line) { // ... }
If the file can not be read, a FilesystemException is thrown.
| parameters | string | $file_name | File path to read. |
| return | this |
To construct, pass the path to a file.
| return | void |
Closes the file handle.
| return | $this |
Close the file handle, if it is open.
| return | string | Next chunk of the file. |
Read the file chunk-by-chunk.
| return | void |
Closes the file handle if it is open, and reopens it.