note 115879 deleted from tutorial.firstpage by philip
| From: | philip@php.net | Date: | Wed, 27 Apr 2016 04:49:05 +0000 |
| Subject: | note 115879 deleted from tutorial.firstpage by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205357@lists.php.net to get a copy of this message | ||
Note Submitter: ivan at ivandigital dot com
----
Note on Line Feeds
These are 2 alternative ways to add a line feed after a php block.
---
1. Echo a "\n" at the end of the block.
<?php
echo "Hello World";
echo "\n";
?>
Alternatively you can also concatenate "\n" to the last echo/print in the block.
<?php
echo "Hello World" . "\n";
?>
Note: the string "\n" must be inside double quotes; using single quotes will output the
literal string.
---
2. Add two line feeds after the closing ?> tag.
By explicitly adding two line feeds after the closing ?> tag, the first one will be removed by
php, and the second one will appear in the output.
---
One advantage of both approaches is that you don't need to add a space after the closing ?>
tag (to force a space and a line feed to be output), instead, only the line feed is output.