Bird
0
0

In PHP, what type of value does the gettype() function return when passed a variable?

easy📝 Conceptual Q1 of 15
PHP - Type Handling
In PHP, what type of value does the gettype() function return when passed a variable?
AA string describing the variable's type
BAn integer representing the type code
CA boolean indicating if the variable is set
DAn object representing the variable's class
Step-by-Step Solution
Solution:
  1. Step 1: Understand gettype()

    The gettype() function returns the type of the variable as a string.
  2. Step 2: Check return values

    It returns strings like "integer", "string", "array", etc., not integers or objects.
  3. Final Answer:

    A string describing the variable's type -> Option A
  4. Quick Check:

    gettype() returns a descriptive string [OK]
Quick Trick: gettype() always returns a string describing the type [OK]
Common Mistakes:
  • Thinking gettype() returns a numeric code
  • Confusing gettype() with is_type() functions
  • Assuming gettype() returns an object

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes