PHP File Exists

PHP File exists

The file_exists() function can be used to determine if a file exists. Once you know the condition, you can execute the code based on that result.

The code belows checks to see if there is a file called that is located one directory down from the current directory. If the file exists, it is included. Otherwise, the file that is located in the same directory is included.

$login_file = '../';
if (file_exists($login_file)) {