Bird
0
0

Find the error in this PHP code:

medium📝 Debug Q14 of 15
PHP - Basics and Execution Model
Find the error in this PHP code:
<?php
echo "Hello World!"
?>
AIncorrect quotes around text
BWrong PHP start tag
CMissing semicolon after echo statement
DMissing closing PHP tag
Step-by-Step Solution
Solution:
  1. Step 1: Check the echo statement syntax

    In PHP, each statement must end with a semicolon. The echo line is missing it.
  2. Step 2: Verify other parts

    The PHP start tag and quotes are correct. The closing PHP tag is optional but present.
  3. Final Answer:

    Missing semicolon after echo statement -> Option C
  4. Quick Check:

    Statements need semicolon [OK]
Quick Trick: Always end PHP statements with a semicolon [OK]
Common Mistakes:
  • Forgetting semicolon at end of statement
  • Confusing PHP tags with HTML tags
  • Using wrong quotes like single without closing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes