What is the issue the user is facing with reading every 10th line from a text file in PHP?

The user is facing the issue of reading every 10th line from a text file in PHP. One way to solve this is to keep track of the line number while reading the file and only output the lines that are multiples of 10.

<?php
$filename = "example.txt";
$file = fopen($filename, "r");
$line_number = 0;

while (!feof($file)) {
    $line = fgets($file);
    $line_number++;

    if ($line_number % 10 == 0) {
        echo $line;
    }
}

fclose($file);
?>