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 "Welcome to PHP!"
?>
AEcho cannot print strings
BWrong opening PHP tag
CMissing semicolon after echo statement
DQuotes should be single quotes
Step-by-Step Solution
Solution:
  1. Step 1: Check PHP syntax rules

    Each statement must end with a semicolon to separate commands.
  2. Step 2: Identify missing semicolon

    The echo line lacks a semicolon at the end, causing a syntax error.
  3. Final Answer:

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

    Statements end with ; = Missing semicolon [OK]
Quick Trick: Every PHP statement ends with a semicolon [OK]
Common Mistakes:
  • Ignoring semicolon at line end
  • Thinking double quotes cause error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes