Bird
0
0

Identify the error in this PHP code:

medium📝 Debug Q6 of 15
PHP - Output and String Handling
Identify the error in this PHP code:
echo "Hello World'
AMissing semicolon at the end
Becho cannot output strings
CVariable $Hello is undefined
DMismatched quotes in the string
Step-by-Step Solution
Solution:
  1. Step 1: Check string quotes

    The string starts with a double quote but ends with a single quote, causing a syntax error.
  2. Step 2: Understand PHP string rules

    Strings must start and end with the same type of quote (both double or both single).
  3. Final Answer:

    Mismatched quotes in the string -> Option D
  4. Quick Check:

    Quotes must match in strings [OK]
Quick Trick: Start and end strings with the same quote type [OK]
Common Mistakes:
  • Ignoring mismatched quotes
  • Assuming missing semicolon causes error
  • Confusing variables with strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes