Need Assistance?

support@tutorialshub.in

Strings & Regular Expressions

Single vs Double Quotes, Heredoc & Nowdoc

ADVERTISEMENT
PHP Free Lesson
5 min read
ADVERTISEMENT

In PHP, single-quoted strings ('...') treat text literally, whereas double-quoted strings ("...") parse variables like $name and escape sequences like \n.

For multi-line text or HTML/SQL blocks, use Heredoc (<<<HTML, supports variables) or Nowdoc (<<<'TEXT', literal text without variable parsing).

ADVERTISEMENT
Hi, I'm Tuby! Here to help you