13.5. Checking Whether a File ExistsThe act of checking whether a file exists is one of the most basic file-related tasks you'll want to do, and file_exists( ) makes it as easy as it should be. Specify the filename to check as the only parameter, and it returns true if the file exists and false otherwise. For example: if (file_exists("snapshot1.png")) { print "Snapshot1.png exists!\n"; } else { print "Snapshot1.png does not exist!\n"; }
|