Bird
0
0

Which of the following is a valid way to assign a boolean value in PHP?

easy📝 Syntax Q3 of 15
PHP - Variables and Data Types
Which of the following is a valid way to assign a boolean value in PHP?
AAll of the above
B$flag = True;
C$flag = TRUE;
D$flag = true;
Step-by-Step Solution
Solution:
  1. Step 1: Check boolean assignment syntax

    PHP boolean literals are case-insensitive: true, TRUE, True all work.
  2. Step 2: Confirm all options are valid

    All given assignments are valid boolean assignments in PHP.
  3. Final Answer:

    All of the above -> Option A
  4. Quick Check:

    Boolean literals are case-insensitive [OK]
Quick Trick: Boolean true/false are case-insensitive in PHP [OK]
Common Mistakes:
  • Thinking only lowercase true is valid
  • Confusing PHP with case-sensitive languages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes