Bird
0
0

Identify the problem in the following PHP code snippet:

medium📝 Debug Q6 of 15
PHP - Basics and Execution Model
Identify the problem in the following PHP code snippet:
<?php
// Comment line
/* Unfinished comment
 echo 'Hello';
?>
AThe multi-line comment is not properly closed
BThe single-line comment syntax is incorrect
CThe echo statement is missing a semicolon
DPHP tags are incorrectly placed
Step-by-Step Solution
Solution:
  1. Step 1: Analyze comments

    The code has a multi-line comment starting with /* but no closing */.
  2. Step 2: Check other elements

    The single-line comment with // is correct, echo statement has semicolon, and PHP tags are fine.
  3. Final Answer:

    The multi-line comment is not properly closed -> Option A
  4. Quick Check:

    Unclosed /* comment causes syntax errors [OK]
Quick Trick: Always close multi-line comments with */ [OK]
Common Mistakes:
  • Forgetting to close multi-line comments
  • Assuming single-line comments can close multi-line blocks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes