Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics Daily Exercise Program Strings

Heredoc srting appear in one line when using the browser to see the o/p ! why?

when i add this string and see th o/p through the browser it come in one line but its working with Consol so why it dosent work wtih the browser

$mystr = <<<EOL
we here for adding
  some text with 
no need for escape
EOL;

i think when you use Heredoc and display it in the browser it's treated as single line comment by php if you want to output same as on the example you can use <br> for each paragraph you want to break

$myString = <<<"EOT"
Example of string <br>
spanning multiple lines<br>
using spaces<br>
and including a $name variable\n
using heredoc syntax.
EOT;

echo $myString;