by performance reasons we should use only realpath() instead of realpath() + file_exists() when checking existence of a file or directory ??
CASE A ::
if(realpath(__DIR__."/../file.php")===false)
CASE B ::
if(file_exists(realpath(__DIR__."/../file.php"))===false)
i think CASE A do the job, and CASE B do the job two times.
Not only is case B redundant (as realpath returns false if the path cannot be resolved or the file does not exist as per the docs), if the file does not exist, that is a bit silly.
Since this statement will return
FALSE:This:
Is really this:
As a side note: `realpath` will never return a “FALSY” value. By this I mean that it will never return something which `== FALSE` but does not `=== FALSE` (eg. `NULL`, `”`, 0, array()). Why? Well, the real path will always include a reference to the root — `/` in *nix systems (Mac, Unix, Linux) and `C:\` in Windows, and those two strings will evaluate to true when used as a boolean (say in an if, while, or for loop). This means you can just do:
Or, if you need to actually have the realpath, you can: