What are the potential issues with using if statements within a while loop for file processing in PHP?

When using if statements within a while loop for file processing in PHP, there is a risk of the loop becoming infinite if the condition within the if statement is never met. To solve this issue, you should ensure that the condition within the if statement is updated within the loop to eventually exit the loop.

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

while (!feof($file)) {
    $line = fgets($file);
    
    // Process the line here
    
    if (/* some condition to exit the loop */) {
        break;
    }
}

fclose($file);
?>