Checking File Existence in PHP


Check if a file or directory exists before attempting to use it.

Source Code

if (file_exists('example.txt')) {
    echo "The file exists";
} else {
    echo "The file does not exist";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments