I’ve received a boolean from a query, and I want to check if the boolean’s value is greater than zero. Is it possible to modify the approach used when handling resources to check a boolean’s value? (See; example of resource handling below:)
return (mysql_result($query, 0) == 1) ? true : false;
Any help appreciated.
Thank you in advance.
Since PHP would interpret as a string, you can simply cast it as
(bool)Non-zero values will cast as
TRUE. Note that you should only do this if the return values are 0 or 1. Negative values will cast asTRUE.