How to check if a file is readable in PHP?

To check if a file is readable in PHP, you can use the is_readable() function. It returns true if the file exists and is readable, and false otherwise. Here's an example:

$filename = 'path/to/file.txt'; if (is_readable($filename)) { echo 'The file is readable.'; } else { echo 'The file is not readable.'; }

Make sure to replace 'path/to/file.txt' with the actual file path and name.