ID: 10234 Comment by: only-pvc540 at hotmail dot com Reported By: ruslan2000 at mail dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: Win2000 Prof PHP Version: 4.0.4pl1 New Comment:
<a href=http://only-realtime-pvc-u.da.ru>only pvc</a> Previous Comments: ------------------------------------------------------------------------ [2001-04-08 15:08:31] [EMAIL PROTECTED] For string comparison use !== for NOT and === for EQUALS. -Chris ------------------------------------------------------------------------ [2001-04-08 14:58:54] ruslan2000 at mail dot com <?php /* I want to compare two strings and if they are equal show a message on the screen. But I discovered that it's imposible, because PHP think that they are equal anyway :((( Example of script */ //EX 1. something wrong $qqq = "00041001001001001001001001001001001002000"; $xxx = "00041001001001001000000000000000000000000"; # with != just the same effect as <> if ($qqq <> $xxx) echo "<hr>$qqq<br> <b>!=</b> <br>$xxx<hr>"; //it should be on the screen, but ... else echo "<hr>$qqq<br> <b>=</b> <br>$xxx <hr>"; //it's appear every time on the screen :((( if ($qqq != $xxx) echo "<hr>$qqq<br> <b>!=</b> <br>$xxx"; else echo "<hr>$qqq<br> <b>=</b> <br>$xxx <hr>"; //(strval($qqq) != strval($xxx)) does not work too if (strval($qqq) != strval($xxx)) echo "<hr>$qqq<br> <b>!=</b> <br>$xxx<hr>"; else echo "<hr>$qqq<br> <b>=</b> <br>$xxx <hr>"; //EX 2 - all OK $qqq = "00041001000000000000000000000000000000000"; $xxx = "00041001001001001001001001001001001002000"; # with != just the same effect as <> if ($qqq <> $xxx) echo "$qqq<br> <b>!=</b> <br>$xxx"; else echo "$qqq<br> <b>=</b> <br>$xxx <hr>"; if ($qqq != $xxx) echo "$qqq<br> <b>!=</b> <br>$xxx"; else echo "$qqq<br> <b>=</b> <br>$xxx <hr>"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=10234&edit=1
