When you need multi-line strings, heredoc and nowdoc provide a clean alternative to concatenation or escaped quotes.
- Heredoc (
<<<EOT) behaves like a double-quoted string — variables are interpolated. - Nowdoc (
<<<'EOT') behaves like a single-quoted string — no interpolation, content is literal.
Since PHP 7.3 the closing marker no longer needs to be at column 0, so heredoc/nowdoc can be indented naturally inside functions and classes.