What are some alternative approaches to reading files in PHP besides using fopen and file()?

When reading files in PHP, besides using fopen and file(), you can also use file_get_contents() and fread(). These functions provide alternative approaches to reading file contents in PHP.

// Using file_get_contents() to read a file
$file_contents = file_get_contents('example.txt');
echo $file_contents;

// Using fread() to read a file
$handle = fopen('example.txt', 'r');
$file_contents = fread($handle, filesize('example.txt'));
fclose($handle);
echo $file_contents;