Possible Duplicate:
Have I misunderstood what heredoc should do?
I read that Here document preserves the line breaks
and other whitespace (including indentation) in the text. But when I run the following script,everything gets printed on the same line. Why is it so ?
<?php
$str = <<<HDC
This is a sample text
Some more sample text
Even more sample text
HDC;
echo $str;
The output actually does contain the line breaks. However, HTML (by default) ignores line breaks.
If you want the HTML to render the line breaks, wrap it in a
pre: