RE: [PHP] echo
| From: | Chris W. Parker | Date: | Tue, 30 Nov 2004 20:27:07 +0000 |
| Subject: | RE: [PHP] echo | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203179@lists.php.net to get a copy of this message | ||
Christopher Weaver <mailto:booktues@yahoo.com>
on Monday, November 29, 2004 6:20 PM said:
> I can't get this code, pasted from the documentation, to work
> properly. The new lines don't occur where they should.
You are probably expecting the wrong thing. The "newlines" only appear
in the source of the page. I imagine you are expecting to see a new line
when viewing the page through the browser. In this case you must use a
<br> tag.
Here are two examples:
1. This will only show a new line when you view the source.
<?php
echo "Hello\nWorld";
?>
2. This will only show a new line when viewed through the browser.
<?php
echo "Hello<br>World";
?>
3. This will show both.
<?php
echo "Hello<br>\nWorld";
?>
hth,
chris.