Bird
0
0

You want to store a multi-line SQL query in a PHP variable without parsing variables inside it. Which syntax should you use?

hard📝 Application Q8 of 15
PHP - Output and String Handling
You want to store a multi-line SQL query in a PHP variable without parsing variables inside it. Which syntax should you use?
ANowdoc syntax
BSingle-quoted string
CDouble-quoted string
DHeredoc syntax
Step-by-Step Solution
Solution:
  1. Step 1: Identify requirement

    The query is multi-line and must not parse variables inside.
  2. Step 2: Choose syntax

    Nowdoc syntax supports multi-line strings and treats content literally without parsing variables.
  3. Final Answer:

    Nowdoc syntax -> Option A
  4. Quick Check:

    Multi-line literal string = nowdoc [OK]
Quick Trick: Use nowdoc for multi-line literal strings [OK]
Common Mistakes:
  • Using heredoc which parses variables
  • Using single quotes which don't support multi-line easily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes