Bird
0
0

Which of the following statements about null in PHP is TRUE?

easy📝 Conceptual Q2 of 15
PHP - Variables and Data Types
Which of the following statements about null in PHP is TRUE?
ANull variables always evaluate to true
BNull is the same as an empty array
CNull can be used as a string value
DA variable set to null is considered unset
Step-by-Step Solution
Solution:
  1. Step 1: Understand how null affects variable state

    Setting a variable to null means it is considered unset by PHP functions like isset().
  2. Step 2: Compare null with other types

    Null is not an empty array, does not evaluate to true, and is not a string.
  3. Final Answer:

    A variable set to null is considered unset -> Option D
  4. Quick Check:

    Null means variable is unset = C [OK]
Quick Trick: Null means variable is unset, not empty array or true [OK]
Common Mistakes:
  • Confusing null with empty array
  • Assuming null is true
  • Using null as string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes