// remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
bool defined ()
Returns TRUE if the named constant given by name has been defined, FALSE otherwise.
bool define ()
Defines a named constant at runtime.
My question is why use a bool operator "or" to link them together?
Why not the following way:
if (!defined('YII_DEBUG'))
define('YII_DEBUG',true);
My hypothesis is that in the "or" statement, the bool value is calculated one by one. If the first is true, the the whole statement just return truth. The second part(
Even though Yii::trace() only logs in debug mode, it still gets called and the expensive conversion method would also get executed. Using the above construct is a simple one liner that stops evaluating the expression if the left hand side is false.