note 100177 added to function.print
| From: | (gksystems) | Date: | Wed, 29 Sep 2010 17:30:33 +0000 |
| Subject: | note 100177 added to function.print | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172819@lists.php.net to get a copy of this message | ||
sdaau's 22-Dec-2009 note is incorrect.
print "" does *not* append a "\n" character.
It produces the same output as echo -- no bytes at all.
This script edited on Linux *will* output a single "\n" character:
1: <?php
2: print "";
3: ?>
4:
The newline character is the one following '>' at the end of the script. If the script
was edited on Windows, you would get two characters "\r\n".
To avoid this, don't terminate the last line of the script.
If your text editor won't let you end a file with an unterminated line, then you could do this:
1: <?php
2: print "";
3: exit;
4: print "this will never happen";
5: ?>
6: <b>neither will this</b>
7:
The script above will generate Content-Length: 0, because exit causes output to stop immediately.
...Tom
----
Server IP: 66.207.199.35
Probable Submitter: 64.253.149.226
----
Manual Page -- http://www.php.net/manual/en/function.print.php
Edit -- https://master.php.net/note/edit/100177
Del: integrated -- https://master.php.net/note/delete/100177/integrated
Del: useless -- https://master.php.net/note/delete/100177/useless
Del: bad code -- https://master.php.net/note/delete/100177/bad+code
Del: spam -- https://master.php.net/note/delete/100177/spam
Del: non-english -- https://master.php.net/note/delete/100177/non-english
Del: in docs -- https://master.php.net/note/delete/100177/in+docs
Del: other reasons-- https://master.php.net/note/delete/100177
Reject -- https://master.php.net/note/reject/100177
Search -- https://master.php.net/manage/user-notes.php