When I cast to Boolean (using (bool)
), is there a built in way to get PHP to actually return the constants true
or false
. At the moment I'm getting 1
or blank, which evaluate to true and false respectively.
I want the value returned for clearer semantics. However, if I can't get it, I'll just settle with 1 and blank.
In case you're too lazy to do a comparison and echo
a string or if you just want to keep it short you can use :
var_export($boolean, true); // the second parameter is to return and not output
PHP: var_export
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