How can you display the content of a text file in PHP line by line instead of all together?

When displaying the content of a text file in PHP, you can read the file line by line using the `fgets()` function within a loop. This allows you to output the content of the file line by line instead of all together.

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

if ($file) {
    while (!feof($file)) {
        echo fgets($file) . "<br>";
    }
    fclose($file);
}