Bird
0
0

Which of these is the correct way to write a PHP comment?

easy📝 Syntax Q3 of 15
PHP - Basics and Execution Model
Which of these is the correct way to write a PHP comment?
A// This is a comment
BBoth A and D
C<!-- This is a comment -->
D# This is a comment
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP comment syntax

    PHP supports single-line comments with // and #.
  2. Step 2: Evaluate options

    // and # are valid PHP single-line comments; B is HTML comment syntax.
  3. Final Answer:

    Both A and D -> Option B
  4. Quick Check:

    PHP single-line comments = // and # [OK]
Quick Trick: Use // or # for single-line PHP comments [OK]
Common Mistakes:
  • Using HTML comments in PHP code
  • Confusing comment syntax with other languages
  • Forgetting to close multi-line comments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes