The reason for "and" to have such a low precedence is so you can use it to
perform conditional processing. You can probably achieve every effect using
"&&", but you'd need more parentheses. More typically you would use "or" in
this fashion:

    defined('DS') or define('DS', DIRECTORY_SEPARATOR);

This checks if DS is defined and defines it if not.

    APP_ENV != 'prod' or die('This feature must not be used in production');

If we're in production, stop execution with an error. Using || here would
try to logically or the string 'prod' with the return value of die(). Of
course, die() doesn't return, so the script would exit no matter what
APP_ENV was set to.

David

Reply via email to