Is there a way to perform double require_once statement where the second one as a fallback if the first one fails?
For example: I can do this
mysql_query() or die("Boo");
Could I do:
require_once('filename') or require_once('../filename');
If one fails it reverts to the other?
You can’t do this because of a weird little quirk in PHP.
require_once()is a language construct, not a function. It will interpret the whole line as the argument:(added braces for clarity) the result of this operation is
1.Use
is_readable()instead.or a shorter version that should work: