This tutorial is about check file or directory is exist or not on server.PHP has file_exists($path) function to check
File is exist or not.
Today I am working on XML file. Where I will convert XML file into Associative array.
So first I need to assured file is exist or not if exist then I will do next step otherwise I will show message file does not exist.
This method also work on directory to check directory EXIST or NOT.This method return true if exist otherwise false.
1 2 3 4 5 6 7 8 9
if (file_exists($path)) {
echo "The file $path exists";
} else {
echo "The file $path does not exist";
}