ID: 12876
Updated by: derick
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: Strings related
Operating System: Linux Debian 2.2r2 (testing)
PHP Version: 4.0.6
New Comment:

You miss something :) Strings will be converted to a number first, which is not 
possible. The result of this conversion is 0, and (0 == 0) => TRUE.

Derick

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

[2001-08-21 10:27:54] [EMAIL PROTECTED]

When strings are compared to 0, they always return TRUE.

<?php
$test = 'somestring';
if( $test == 'somestring')
echo "Match 1\n";
if( $test == 0 )
echo "Match 2\n";
if( $test == 1 )
echo "Match 3\n";
if( $test != 0 )
echo "Match 4\n";
if( $test != 'somestring' )
echo "Match 5\n";
if( $test != 1 )
echo "Match 6\n";
?>

Expected Output:
Match 1


Actual Ouput:
Match 1
Match 2
Match 6

Is there something I'm missing?


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



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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to