#34426 [Bgs]: implicit string casting problem
| From: | mbphp at netzone dot ch | Date: | Thu, 08 Sep 2005 15:47:36 +0000 |
| Subject: | #34426 [Bgs]: implicit string casting problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84748@lists.php.net to get a copy of this message | ||
ID: 34426
User updated by: mbphp at netzone dot ch
Reported By: mbphp at netzone dot ch
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.4.0
New Comment:
yes, i know that it works with ===, but i think the behaviour is not
correct.
why is there a type-casting if both operators are strings?
it is slower only and the result is not correct.
if one of the operators is a numeric variable (float, int, ...)
type-casting make sense, but not if both are strings.
Previous Comments:
------------------------------------------------------------------------
[2005-09-08 12:48:45] tony2001@php.net
Use === operator for that.
------------------------------------------------------------------------
[2005-09-08 12:44:54] mbphp at netzone dot ch
Description:
------------
compare of 2 string with numbers >> implicit casting
$a="1.5";
$b="1.50";
$a==$b gives true.
which is not correct
both are strings, so casting to another type is not ucorrect i think.
if the variables are of different type casting is ok but not if both
are of the same type.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34426&edit=1