#28381 [Opn]: <?= $variable ?> eats up a newline if it follows ?>
| From: | mikemc-phpbug2 at contactdesigns dot com | Date: | Thu, 13 May 2004 03:50:44 +0000 |
| Subject: | #28381 [Opn]: <?= $variable ?> eats up a newline if it follows ?> | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59565@lists.php.net to get a copy of this message | ||
ID: 28381
User updated by: mikemc-phpbug2 at contactdesigns dot com
Reported By: mikemc-phpbug2 at contactdesigns dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Linux 2.4.20-28.9smp
PHP Version: 4.3.6
New Comment:
Almost forgot the workaround! You can insert a space right after "?>"
and the newline gets output.
Yes it is specific to newlines for example, this:
<?= $_SERVER['PHP_SELF'] ?>*
I should be on a new line - but I am not!
Outputs this:
testing.php*
I should be on a new line - but I am not!
So PHP only seems to eat the newline - it ignores the "*". Wonder if
there are any other characters it doesn't like?
Previous Comments:
------------------------------------------------------------------------
[2004-05-13 05:44:52] mikemc-phpbug2 at contactdesigns dot com
Description:
------------
This isn't a major bug, but I would think it should be classified as a
bug just so that it is on the radar screen. For those of us too lazy
to write <?php echo $variable ?> and instead prefer <?= $variable ?>,
if a newline immediately follows the "?>" then PHP eats the new line
:-(
Reproduce code:
---------------
vi test.php (then insert following code and :wq Enter)
<?= $_SERVER['PHP_SELF'] ?>
I should be on a new line - but I am not!
[shellprompt]# php test.php
testing.phpI should be on a new line - but I am not!
Expected result:
----------------
testing.php
I should be on a new line - but I am not!
Actual result:
--------------
testing.phpI should be on a new line - but I am not!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28381&edit=1