countFileLines.php
Table of Contents
Functions
- countFileLines() : int
- Counts the number of lines in a file.
Functions
countFileLines()
Counts the number of lines in a file.
countFileLines(string|null $file) : int
This function efficiently counts lines by reading the file in chunks, making it suitable even for very large files.
Example usage:
use function oihana\files\countFileLines;
$count = countFileLines('/path/to/file.log');
Parameters
- $file : string|null
-
The full path to the file.
Tags
Return values
int —The total number of lines in the file.