Booleantrue/falseandthestrings & quot; true & quot;/& quot; false &

Source: Internet
Author: User
Booleantruefalseandthestrings & amp; quot; true & amp; quot; false & amp;
Booleans are used to represent the concepts of true and false. they are most often used for testing if a statement is true or false and they'll play a bigger role when we discuss logical expressions. note that there is a difference between boolean true/false and the strings "true"/"false ".

  1. Booleans and NULL
  2. /* Booleans are used to represent the concepts of true and false.
  3. They are most often used for testing if a statement is true or false and
  4. They'll play a bigger role when we discuss logical expressions.
  5. Note that there is a difference
  6. Boolean true/false and the strings "true"/"false ".
  7. */
  8. $ Bool1 = true;
  9. $ Bool2 = false;
  10. // When booleans are displayed, PHP will attempt to convert them into a string
  11. // You'll get either "1"/"0" or "1 leading /" instead of true/false
  12. ?>
  13. $ Bool1:
  14. $ Bool2:

  15. /* NULL is used to represent the concept of nothing or the state of being empty
  16. In the below example three variable have been set,
  17. Then boolean tests are saved Med and the results are output as a string
  18. */
  19. $ Var1 = 3;
  20. $ Var2 = "cat ";
  21. $ Var4 = NULL;
  22. // Isset tests whether a variable has been set
  23. // It returns true or false as a result of the test.
  24. ?>
  25. $ Var1 is set:
  26. $ Var2 is set:
  27. $ Var3 is set:
  28. $ Var1 is set:
  29. $ Var2 is set:
  30. $ Var3 is set:

  31. $ Var1 empty:
  32. $ Var4 empty:

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.