I\'m very new to PHP so I know I am missing something obvious here - I thought the heredoc function is supposed to retain formatting, line breaks, etc. But whenever I test
It will produce a string identical to the one you set.
However, browsers render multiple whitespace condensed to one space character. This is by design.
To preserve your spaces, you can use the pre element (assuming default browser stylesheet) or white-space: pre CSS property.
pre
white-space: pre
jsFiddle.