Returns whether a file exists.
The file_exists() function can be used to check whether a specific file exists. It returns TRUE if the file exists and FALSE otherwise.
<?php
$file = "file_exists.php";
if (file_exists($file)) {
print "The file $file exists";
} else {
print "The file $file does not exist";
}
?> The file file_exists.php exists The code shows how to check the existence of a file.