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....
例如電視劇里面經(jīng)常講到的一句話: 如果那個(gè)漂亮妹子(帥哥)被我泡到手了,我死都愿意。 用計(jì)算機(jī)的代碼完全可以寫(xiě)出這句話: 如果我泡到了漂亮妹子 則:我愿意去死 如果沒(méi)有泡到 則:我不愿意去死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 //聲明一個(gè)變量(拼音)為布爾 $buer = true; //導(dǎo)明一個(gè)變量(英文) $bool = false; ?>English word
true
Pronunciation: [tru:]
Explanation: truly; indeed; correctly; properly;
false
Explanation: hypocritical; incorrect
boole
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 . 整數(shù)值=0 浮點(diǎn)數(shù)=0.0 空字符串 空數(shù)組
Object without variable members.
The variable value is NULL
For example:
$a= false; //$a設(shè)置為假 $b=NULL: //$b設(shè)置為null $c=NULL; //$c設(shè)置為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.