note 115878 added to tutorial.firstpage
| From: | ivan at ivandigital dot com | Date: | Tue, 07 Oct 2014 20:44:08 +0000 |
| Subject: | note 115878 added to tutorial.firstpage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200605@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 72.52.91.14
Probable Submitter: 186.151.89.116
----
Manual Page -- http://php.net/manual/en/tutorial.firstpage.php
Edit -- https://master.php.net/note/edit/115878
Del: integrated -- https://master.php.net/note/delete/115878/integrated
Del: useless -- https://master.php.net/note/delete/115878/useless
Del: bad code -- https://master.php.net/note/delete/115878/bad+code
Del: spam -- https://master.php.net/note/delete/115878/spam
Del: non-english -- https://master.php.net/note/delete/115878/non-english
Del: in docs -- https://master.php.net/note/delete/115878/in+docs
Del: other reasons-- https://master.php.net/note/delete/115878
Reject -- https://master.php.net/note/reject/115878
Search -- https://master.php.net/manage/user-notes.php