Bird
0
0

Which of the following is the correct syntax to set PHP to report all errors including notices?

easy📝 Syntax Q3 of 15
PHP - Error and Exception Handling
Which of the following is the correct syntax to set PHP to report all errors including notices?
Aerror_reporting(E_PARSE);
Berror_reporting(E_ALL & ~E_NOTICE);
Cerror_reporting(E_ERROR | E_WARNING);
Derror_reporting(E_ALL);
Step-by-Step Solution
Solution:
  1. Step 1: Understand error_reporting constants

    E_ALL reports all errors including notices; using E_ALL alone enables full reporting.
  2. Step 2: Analyze options

    error_reporting(E_ALL & ~E_NOTICE); excludes notices, C limits to errors and warnings, D only parse errors.
  3. Final Answer:

    error_reporting(E_ALL); -> Option D
  4. Quick Check:

    Report all errors including notices = error_reporting(E_ALL) [OK]
Quick Trick: Use error_reporting(E_ALL) to show all errors including notices [OK]
Common Mistakes:
  • Using bitwise AND instead of OR
  • Excluding notices unintentionally
  • Setting only parse errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes