Bug #13270 Updated: Odd Math/String behaviour when 'echo'ing...
| From: | sniper@php.net | Date: | Wed, 12 Sep 2001 20:58:24 +0000 |
| Subject: | Bug #13270 Updated: Odd Math/String behaviour when 'echo'ing... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-65849@lists.php.net to get a copy of this message | ||
ID: 13270
Updated by: sniper
Reported By: SeanECoates@yahoo.ca
Old Status: Open
Status: Bogus
Bug Type: Math related
Operating System: Windows 2000
PHP Version: 4.0.6
New Comment:
Just a matter of operator precedence:
http://www.php.net/manual/en/language.operators.precedence.php
Not a bug. (. is just another operator, as is + )
--Jani
Previous Comments:
------------------------------------------------------------------------
[2001-09-12 14:55:53] SeanECoates@yahoo.ca
The following code produces strange output:
<?php
echo "one". 1+2 ."two<br>\n";
echo "one". (1+2) ."two<br>\n";
?>
(output:)
2two
one3two
maybe I'm overlooking something, but when excluding the parentheses, causes the first
"one" to not display, and the addition to work incorrectly.
Please email me if you need more details. Obviously, the workaround is to put parentheses around the
math.
Is this because, without parentheses, PHP is treating the statement like this:
echo "one1" + "2two"; // or something similar?
Using PHP4.0.6, Win32 pre-compiled. Other systems untested.
S
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13270&edit=1