How can the is_readable function in PHP help in handling file access conflicts during read and write operations?

When handling file access conflicts during read and write operations in PHP, the is_readable function can be used to check if a file is readable before attempting to read from it. This can help prevent errors or exceptions that may occur when trying to access a file that is not readable due to permission restrictions or other issues.

$file = 'example.txt';

if (is_readable($file)) {
    $data = file_get_contents($file);
    echo $data;
} else {
    echo "Unable to read file. Check file permissions.";
}