I made some tests to compare and measure speed of both functions. is_file seems to be several times faster (I used 10000 iterations for both) than file_
PHP caches both is_file()
and file_exists()
in the stat cache. Call clearstatcache()
to clear it.
Edit:
If anything, the two should take similar amounts of time because they both call the OS's stat() function, but the results of one may be cached for the other by PHP (unless you clearstatcache()
) or by the OS as Yuliy mentions below.