ID:               25943
 User updated by:  wolfgang dot wuensch at ww-informatik dot de
 Reported By:      wolfgang dot wuensch at ww-informatik dot de
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows
 PHP Version:      4.3.2
 New Comment:

Ok, I understand.
Is it possible to check, if the "double" could be to big?

I don't want to use strcmp() every time, because of
performance-problems. I don't know anything about the possibile values
of my "strings".

Would be fine, if the "if-Statement" works independent from my level of
skill concerning datatypes.


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

[2003-10-22 01:21:12] [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

php -r \'
$a = \"0205100104040203000000000000001\";
$b = \"0205100104040203000000000000002\";
var_dump($a == $b);\'
== true

php -r \'
$a = \"0205100104040203000000000000001\";
$b = \"0205100104040203000000000000002\";
var_dump($a === $b);\'
== false.

php will cast strings to numbers and compare them.. - depending on your
system. the number may be too big to store in an double.. 
- use bcmath or === or strcmp...


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

[2003-10-22 01:07:24] wolfgang dot wuensch at ww-informatik dot de

Description:
------------
I compare two strings, who are different from each other.

The if-Statement gives me a "true".

I want a "false".

Reproduce code:
---------------
$val1="020510010404020301";
$val2="020510010404020302";

if( $val1 == $val2  )
{
    echo $val1;
    echo "<br>";
    echo $val2;
    echo "<br>";
    echo "is not good";
}
else {
    echo "yeah";
}

Expected result:
----------------
go into the "else"

Actual result:
--------------
go into the "if"



Note:
var_dump() used with $var1 and $var2 gives me string(18)

strcmp() works fine.


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


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

Reply via email to