The question is quite simple: When it comes to touching the disk, are these two examples equal, or does scenario #2 touch the disk twice?
Scenario #1
include '/path/to/file.php';
Scenario #2
if (file_exists('/path/to/file.php'))
include '/path/to/file.php';
I know that scenario #1 touches the disk once. Now, as I understand it file_exists()
caches the path and whether or not the file exists. In order to clear that cache you need to call clearstatcache()
.
But does include
, et alii, also use that cache? Or is it exclusive to file_exists()
?