These both functions are used to check the existence of the file. But there is a minor difference between these functions.
Let’s see what’s the difference.
This function takes the path as a parameter and return TRUE or FALSE. This function will return TRUE in case of file exists and FALSE in case if file is not exists. Check below code for more details.
On more thing is that this function will return TRUE if you pass the path for the valid directory also. Check below code,
Unlike file_exists(), is_file() function will check only for the valid files. If we pass the valid path to any directory then it will return FALSE.
Check below code:
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash