PHP data type B...LOGIN

PHP data type Boolean (actually it is the Chinese Book of Changes)

The Boolean type is a non-Chinese explanation, a foreign language in English.

The so-called Boolean type, after being translated from Chinese, is better explained in the language of the Book of Changes in Taoism, which is:

  • Yin/Yang

  • Male/Female

  • True/False

  • True/Wrong

  • Existence/absence

  • ##0/1

    Wait....

Yes A summary of our logical judgments in the process of human reproduction.

例如电视剧里面经常讲到的一句话:
如果那个漂亮妹子(帅哥)被我泡到手了,我死都愿意。
用计算机的代码完全可以写出这句话:
  如果我泡到了漂亮妹子
       则:我愿意去死
  如果没有泡到
       则:我不愿意去死

In our thinking process, we always follow the appeal thinking mode to think about problems. Therefore, our predecessors have summarized it for us and call this way of judgment and thinking in computers Boolean judgment. A data type is specially made for this way of thinking, which is the Boolean type.

The Boolean type is: true and false.

The translation of true and false in English is:

    ##true (true)
  • false (false)
  • Therefore, we can declare it like this in the PHP code.
<?php
//声明一个变量(拼音)为布尔
$buer = true;
//导明一个变量(英文)
$bool = false;
?>

English word
true

Pronunciation: [tru:]
Explanation: truly; indeed; correctly; properly;

false

Pronunciation: [fɔ:ls]

Explanation: hypocritical; incorrect

boole

Full English name: boolean

Pronunciation: [bu:l]
Explanation: Boolean type , Boolean mathematical system

Note: Do not put quotation marks around true and false. Type conversion will be explained in a later course.

布尔值=false  .
整数值=0
浮点数=0.0
空字符串
空数组

Object without variable members.

The variable value is NULL

For example:

$a= false;        //$a设置为假
$b=NULL:        //$b设置为null
$c=NULL;        //$c设置为null

Except for the above cases, the values ​​in other cases will be converted to true. Generally speaking, 1 is true, 0 is false. These transformations will be frequently encountered in subsequent judgment statements.

Next Section
<?php //声明一个变量(拼音)为布尔 $buer = true; //导明一个变量(英文) $bool = false; ?>
submitReset Code
ChapterCourseware