follow us on google+ follow us feedburner

FORUM
Please use the search function and/or read the FAQ first.

Multiline echo doesn't work



October 10, 2012 06:23PM
I've recently installed EasyPHP v12+ on a Windows XP system and am learning PHP with the help of "Learning PHP, MySQL, and Javascript" from O'reilly books, but I've run into a problem almost immediately. Consider the exmple from the book:

<?php
$author = "Alfred E Newman";

echo "This is a headline

This is the first line.
This is the second.
Written by $author.";
?>

It's easy to see what it's supposed to do, but it displays everything on one line. I've tried a similar approach with 'heredoc' syntax:

$text = <<<_END
This is a headline.

This is the first line.
This is the second line.
Written by $author.
_END;

echo $text;

and it still displays everything on one line. Has anyone run into this before?
Options: ReplyQuote
Posted by: Help
October 11, 2012 10:02AM
Hello, you need in the end of every line add <br /> html tag.
Example:
echo "This is a headline <br/>
This is the first line. <br/>
This is the second. <br/>
Written by $author.";
Options: ReplyQuote


Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.