Counting lines in a text file

The following simple code count the number of lines in a text file.

public function countLinesInTextFile($address)
{
    return count(file($address));
}
print countLinesInTextFile('file.txt');