$file = 'example.txt'; $content = file_get_contents($file); echo $content;
$file = 'example.txt'; $handle = fopen($file, 'r'); if ($handle) { while (($line = fgets($handle)) !== false) { echo $line; } fclose($handle); }This code opens the `example.txt` file, reads it line by line and prints each line to the screen. The `file_get_contents` function is part of the core PHP library, while the `fopen` and `fgets` functions are part of the Filesystem functions package.