#19883 [Bgs]: string concatenation bug
| From: | spic@php.net | Date: | Sun, 13 Oct 2002 16:38:29 +0000 |
| Subject: | #19883 [Bgs]: string concatenation bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22305@lists.php.net to get a copy of this message | ||
ID: 19883
Updated by: spic@php.net
Reported By: skaventruc@yahoo.fr
Status: Bogus
Bug Type: Strings related
Operating System: Windows NT
PHP Version: 4.2.0
New Comment:
In that case, simply use
$i = 153;
echo $i*2
echo 'km';
or printf()...
Previous Comments:
------------------------------------------------------------------------
[2002-10-13 11:16:05] skaventruc@yahoo.fr
and when you want to concatenate with dynamic
calculated infos ?
$i = 153;
echo $i*2.'km';
------------------------------------------------------------------------
[2002-10-13 09:47:57] derick@php.net
Why don't you just use '2km' instead of 2.'km' ?
Derick
------------------------------------------------------------------------
[2002-10-13 09:46:06] skaventruc@yahoo.fr
and also :
$e = 0x7C.'km'; // is ok '124km'
$e = 124.'km'; // parse error
why do you process decimal integers in different way
than hexadecimal integers ? If it is only to detect
decimal float then you should take care to the fact that
'.' is not only a decimal separator but also a concatenation
operator !!!
------------------------------------------------------------------------
[2002-10-13 09:41:43] skaventruc@yahoo.fr
maybe you do not consider it as a bug but it is quite
annoying when contatenating arguments, I personnaly
think that this is a lack of the parser/compiler to
do not detect that the '.' is not a part of the '2'
but it is an operator :
putting a '.' after the 2 doesn't change it's display.
$e = 2.3.'km'; // the dot after 2 followed by a digit
// indicate a float
'2.3km'
$e = 2..'km'; // is ok the the dot after 2 is useless
'2km'
$e = 2.'km'; // produce a parse error
$e = 2 .'km'; // is ok
'2km'
------------------------------------------------------------------------
[2002-10-12 22:50:10] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/19883
--
Edit this bug report at http://bugs.php.net/?id=19883&edit=1