Bird
0
0

Which of the following is the correct way to start a heredoc string in PHP?

easy📝 Syntax Q3 of 15
PHP - Output and String Handling
Which of the following is the correct way to start a heredoc string in PHP?
A<<<EOD
B<<<"EOD"
C<<<'EOD'"
D<<<'EOD'
Step-by-Step Solution
Solution:
  1. Step 1: Identify heredoc syntax

    Heredoc starts with <<< followed by an identifier without quotes.
  2. Step 2: Differentiate from nowdoc

    Nowdoc uses single quotes around the identifier, heredoc does not.
  3. Final Answer:

    <<<EOD -> Option A
  4. Quick Check:

    Heredoc start = <<
Quick Trick: Heredoc identifier has no quotes [OK]
Common Mistakes:
  • Using quotes around heredoc identifier
  • Confusing heredoc and nowdoc start syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes