|
|
|
|
|
by itafroma
4103 days ago
|
|
> I feel like I want to test what happens if you put values like "", false, " ", 0, an empty array, etc etc etc in front of ??. All of those would result in the variable being assigned those values: the null check uses the same semantics as is_null(), and the truth table for those values is: $v is_null($v)
------------------
'' FALSE
false FALSE
' ' FALSE
0 FALSE
[] FALSE
If you want to all falsy values to use the fallback value, use the shorthand ternary operator (?:) instead. |
|