The Boolean type is the simplest. The Boolean expression is true or false, and can be either real or fake. To specify a variable as a Boolean value, use the keyword True or false, two are case insensitive, as follows:
<?php
$flag =true;//assigns TRUE to the variable $flag
?>
Boolean types are used to control processes. When two objects are compared, you can use "= =" to determine whether it is true, and when using a Boolean variable for process control, use it directly, without comparing it with the true keyword, as shown in program 2-4.
<?php
$action = "Show_book";
$show _br=true;
Use "= =" to determine
Returns a Boolean type for the IF condition branch judgment
if ($action = = "Show_version") {
echo "You chose to show the current version number!" ";
}
The following code no longer requires
if ($show _br==true) {
echo "<br>\n";
}
Using a simplified Judgment method
if ($show _br) {
echo "<br>\n";
}
?>
The above is the PHP data type of the Boolean variable detailed content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!