Let’s introduce the difference between is_file and file_exists in PHP. is_file only determines whether the file exists; file_exists determines whether the file exists or whether the directory exists;
Share the difference between is_file and file_exists in php for your reference. is_file only determines whether the file exists; file_exists determines whether the file exists or whether the directory exists; is_dir determines whether the directory exists; Looking at the php manual, although the results of these two functions will be cached, is_file is N times faster. Notes: When the file exists, is_file is N times faster than file_exists; When the file does not exist, is_file is slower than file_exists; Conclusion: The file_exits function will not affect the speed depending on whether the file actually exists, but the impact of is_file will be greater. |