Skip to content

Multiline strings in PHP

You can create multline strings in PHP. This is particularly useful if you have, for example, HTML markup in PHP code, without the need to bother with single or double quotes messing with your string. Also, IDEs will more likely detect the HTML code correctly and apply syntax highlighting. To create a multiline string, create a so-called heredoc:

[sc name=”src” url=”https://stackoverflow.com/questions/1848945/best-practices-working-with-long-multiline-strings-in-php” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.