PHP boolval() Function
boolval The function is used to get the boolean value of a variable.
Version requirement: PHP 5 >= 5.5.0, PHP 7.
Syntax
boolean boolval ( mixed $var )
Parameter Description:
- $var: The variable to be converted to a boolean value.
Example
Example
The execution result is as follows:
0: false
42: true
0.0: false
4.2: true
"": false
"string": true
"0": false
"1": true
[1, 2]: true
[]: false
stdClass: true
Available PHP Functions