$db_hased_pw = $result["password"] || false;
I understand the usage of this line of code, but WHEN will it evaluate as false?
will $db_hased_pw equal false only when $result["password"] is undefined?
or is $db_hased_password be set to false if $result["password"] is unset, or false, or zero, or null?
It will evaluate to false when $result["password"] is a "falsy value". The page on empty describes these values.
These would be equivalent:
$db_hased_pw = !!$result["password"];
$db_hased_pw = (bool) $result["password"];
If $result["password"] can indeed be undefined, you should be using:
$db_hased_pw = !empty($result["password"]);
to avoid a notice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With