PHP 4.0 Bug #9478 Updated: Two different types compare problem!

From: Date: Tue, 27 Feb 2001 14:04:57 +0000
Subject: PHP 4.0 Bug #9478 Updated: Two different types compare problem!
Groups: php.dev 
Request: Send a blank email to php-dev+get-47619@lists.php.net to get a copy of this message
ID: 9478 Updated by: stas Reported By: cryp@inet.lv Old-Status: Open Status: Bogus Bug Type: Math related Assigned To: Comments: Use === for exact comparison. == is 'numeric' comparison. Previous Comments: --------------------------------------------------------------------------- [2001-02-27 08:59:02] cryp@inet.lv ### CODE ### $Flag = 0; if ( $Flag == 'N' ) echo "1"; else echo "2"; ### END ### Result: 1 If the $Flag is integer value and 'N' non integer, why this operation gives true as the result? This is different types 0 and 'N', but if the programm can compare this values, it will be better to give "false"! Can you explane this ? --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9478&edit=2

« previous php.dev (#47619) next »