What are some alternative methods to readfile in PHP for displaying file contents within an echo statement?

When trying to display the contents of a file within an echo statement in PHP, the traditional method is to use the `file_get_contents()` function. However, an alternative method is to use the `fopen()`, `fread()`, and `fclose()` functions to read the file contents line by line and then echo each line individually.

$file = fopen('example.txt', 'r');
if ($file) {
    while (($line = fgets($file)) !== false) {
        echo $line;
    }
    fclose($file);
} else {
    echo 'Unable to open file.';
}