Answer the question
In order to leave comments, you need to log in
Where can I find a description of such a logical expression?
Gutted with Yii2 guides. The input script says:
You can guess that this is equivalent to this:defined('YII_DEBUG') or define('YII_DEBUG', true);
if (!defined('YII_DEBUG'))
{
define('YII_DEBUG', true);
}
Answer the question
In order to leave comments, you need to log in
This is all about logical operators:
php.net/manual/ru/language.operators.logical.php
In case of OR, the first expression is executed first and only if it is false, the second one is executed (what is the point of ORing the second expression if the first one is already true?)
for AND will be similar to foo() && bar()
bar() will only be executed if foo() === true
Regarding readability:
1 - it all depends on the context. If it's not clear to the author that it's easy to read, then it's not easy to read
2 - Yii has a very peculiar code style and you shouldn't take an example from them)
3 - [additional] check whether the constant is set or not - it's really bad.. A constant is a constant to be constant. If it exists, then it doesn’t - then it’s a variable, and a bad one =D
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question