Bird
0
0

What does the PHP function array_search() return if the searched value is not found in the array?

easy📝 Conceptual Q2 of 15
PHP - Arrays
What does the PHP function array_search() return if the searched value is not found in the array?
Afalse
B0
C-1
Dnull
Step-by-Step Solution
Solution:
  1. Step 1: Recall array_search() behavior

    array_search() returns the key if found, otherwise it returns false.
  2. Step 2: Understand return types

    It does not return null, -1, or 0 when the value is missing.
  3. Final Answer:

    false -> Option A
  4. Quick Check:

    Value not found = false from array_search() [OK]
Quick Trick: array_search() returns false if value not found [OK]
Common Mistakes:
  • Assuming it returns null
  • Assuming it returns -1
  • Confusing false with 0

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes