I am unable to understand why two conditions containing the same values do not return the same result twice.
Look at the variable content :
$quantity = 1;
var_dump(!$cart = true);
var_dump(!$product = false);
var_dump($quantity <= 0);
--------
Output : bool(false) bool(true) bool(false)
Based on those boolean, I expect the following condition will return TRUE
:
$quantity = 1;
var_dump(!$cart = true || !$product = false || $quantity <= 0);
---------
Output : bool(false)
Why ? I was expected this to be TRUE
And why the following exact same condition output what I expected : TRUE
var_dump(false || true || false);
---------
Output : bool(true)
EDIT
I know that =
is for assignement.
But doing this :
if(!$var = null){
// $var is not empty
}
Is a way to assign a value and check if this value is null|false|empty|array empty...
at the same time.