ID:               36938
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daniele_dll at yahoo dot it
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP SP2 - Fedora Core 4
 PHP Version:      5.1.2
 New Comment:

0 == 0. This is expected.
No bug here.


Previous Comments:
------------------------------------------------------------------------

[2006-04-01 09:34:00] daniele_dll at yahoo dot it

ops, forgotten to re-open the report

sorry

------------------------------------------------------------------------

[2006-04-01 09:33:18] daniele_dll at yahoo dot it

I'll try to explain me ...

$value = 'qwerty';


$value -> qwerty
(int)$value -> 0

so ... how can be that 0 is equal to qwerty?

Try this code too

<?php

$valore = 'qwerty';
$_v = intval($valore);

echo ($valore) ? 'true ' : 'false ';
echo ($_v) ? 'true ' : 'false ';

if ($valore == $_v)
{
    echo "variable ({$valore}) contains a valid numeric value ({$_v})
!";
}
else
{
    echo "variable doesn't contains a valid numeric value!";
}

?>

The result is wrong!

------------------------------------------------------------------------

[2006-03-31 23:25:52] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[2006-03-31 23:17:23] daniele_dll at yahoo dot it

Description:
------------
Type casting a value on an if doesn't work!

If i compare a string value with the same value type casted to an int
and this string doesn't contains a numeric value i recive a true from
the boolean expression!

I've tried many combinations but all return the same result

Thanks for the help

Reproduce code:
---------------
<?php

$valore = 'qwerty';

if ($valore == (int)$valore)
{
    echo "variable contains a valid numeric value!";
}
else
{
    echo "variable doesn't contains a valid numeric value!";
}

?>

Expected result:
----------------
$valore == (int)$valore  --> FALSE

variable doesn't contains a valid numeric value!

Actual result:
--------------
$valore == (int)$valore  --> TRUE

variable contains a valid numeric value!


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36938&edit=1

Reply via email to