Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP boolval() Function

PHP boolval() Function

PHP Available FunctionsAvailable PHP Functions

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:

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

PHP Available FunctionsAvailable PHP Functions