What is the best practice for checking the existence of an image file in PHP?
When checking the existence of an image file in PHP, it is best practice to use the `file_exists()` function along with `is_file()` to ensure that the file exists and is indeed a file. This combination helps to accurately determine if the specified file is an image file.
$imagePath = 'path/to/image.jpg';
if (file_exists($imagePath) && is_file($imagePath)) {
echo 'Image file exists.';
} else {
echo 'Image file does not exist.';
}