PHP Data type of Boolean variable detailed

Source: Internet
Author: User
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)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.