note 100177 deleted from function.print by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Sep 2010 18:33:51 +0000 |
| Subject: | note 100177 deleted from function.print by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172821@lists.php.net to get a copy of this message | ||
Note Submitter: Tom Robinson (gksystems)
----
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