Bird
0
0

You need to comment out a block of PHP code that contains both single ('') and double ("") quotes. Which comment style should you use to avoid syntax errors?

hard📝 Application Q8 of 15
PHP - Basics and Execution Model
You need to comment out a block of PHP code that contains both single ('') and double ("") quotes. Which comment style should you use to avoid syntax errors?
AUse // single-line comments on each line
BUse /* ... */ multi-line comments
CUse # single-line comments on each line
DEnclose the block in HTML comments <!-- ... -->
Step-by-Step Solution
Solution:
  1. Step 1: Understand comment styles

    Multi-line comments /* ... */ can safely comment out blocks with quotes.
  2. Step 2: Evaluate other options

    Single-line comments (// or #) require commenting each line separately, which is error-prone. HTML comments are ignored by PHP.
  3. Final Answer:

    Use /* ... */ multi-line comments -> Option B
  4. Quick Check:

    Multi-line comments handle quotes safely [OK]
Quick Trick: Use /* ... */ to comment blocks with quotes safely [OK]
Common Mistakes:
  • Using single-line comments for multi-line blocks
  • Using HTML comments inside PHP code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes