PHP: Trouver le nombre de ligne d’un fichier

Author:
 
<?php
$lines = 0;
if ($fh = fopen('data.txt','r')) {
  while (! feof($fh)) {
    if (fgets($fh)) {
      $lines++;
    }
  }
}
print $lines;
?>