You have a variable in your PHP script that needs to hold a simple true or false value. What data type would you use?

  • int
  • float
  • string
  • boolean
To hold a simple true or false value in PHP, you would use the boolean data type. The boolean data type is specifically designed to store either true or false values. It is commonly used in conditions, logical operations, or to indicate the success or failure of an operation. By using the boolean data type, you can ensure that the variable only holds the expected true or false values, providing clarity and correctness to your code. Learn more: https://www.php.net/manual/en/language.types.boolean.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *