What is the best practice for verifying the existence of a file in PHP?

When working with files in PHP, it is important to verify the existence of a file before attempting to perform any operations on it. This can be done using the `file_exists()` function in PHP, which returns true if the file exists and false if it does not.

$filename = 'example.txt';

if (file_exists($filename)) {
    echo "The file exists.";
} else {
    echo "The file does not exist.";
}