ID: 27475
User updated by: tim dot lokot at printsoft dot com
Reported By: tim dot lokot at printsoft dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Win2K Pro
PHP Version: 4.3.4
New Comment:
Just found this in the documentation ...
"The value is given by the initial portion of the string. If the string
starts with valid numeric data, this will be the value used. Otherwise,
the value will be 0 (zero)."
Not quite sure why the value zero was chosen, but hey, it's in the
manual so I can live with that.
Previous Comments:
------------------------------------------------------------------------
[2004-03-02 23:01:31] tim dot lokot at printsoft dot com
Description:
------------
For some reason I cannot compare the integer zero to a string and get a
valid response back. There are two ways that I can see to fix it:
1. Use the === operator
2. Typecast the integer to a string
Both of the above solutions work, yet for some reason, the ==
comparison operator doesn't.
Reproduce code:
---------------
<?php
$item = 0;
var_dump ($item);
if ($item == 'rubbish')
echo 'Equals';
else
echo 'Is not equal';
?>
Expected result:
----------------
int(0)
Is not equal
Actual result:
--------------
int(0)
Equals
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27475&edit=1