Is it also true if true here is changed to any character?
phpcn_u1458
phpcn_u1458 2019-07-17 23:00:37
0
3
1439

//Define the winning variable. The value of the variable is true, which means you have won the prize.

$zhongjiang = u;

//Because $ zhongjiang The result is true, so it displays: "Buy a House"

//You can change it to false to try the execution result. If it is false, echo 'Buy a House' will not be executed;


if($zhongjiang){

echo 'Buy a house';

}

//Follow-up code

echo 'What should you do?';

?>


phpcn_u1458
phpcn_u1458

reply all (2)
小陈

If the judgment condition behind if asks about a variable, and its value is the following situations, it will return false

1: Boolean value FALSE
2: Integer value 0 (zero)
3: Floating point value 0.0 (zero)
4: Blank string and string "0"
5: Array without member variables
6: Object without cells (only for PHP 4)
7: Special type NULL (including variables that have not been set)

    angryTom

    By default, 0 is false and non-0 is true. You can use this idea. If the variable is empty, it will also be judged as false.

    • reply That's it, that is, when the value is 0, it is false, and for characters other than 0, which does not include Chinese, it is true. Thanks for the answer.
      phpcn_u1458 author 2019-07-19 04:32:02
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!