What are the rules to determine the “truth” of any value not already of the Boolean type?

In PHP, the “truth” of any value is determined by the following rules: a value is considered “true” if it is a non-zero number or a non-empty string. Any other matters, such as an empty string or zero value, are considered false. Additionally, an array is considered accurate if it contains at least one element and false if it is open. Null is also regarded as wrong.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *