Bug #12876: Comparison with zero (0) returns TRUE
From: ash@freaky-namuh.com
Operating system: Linux Debian 2.2r2 (testing)
PHP version: 4.0.6
PHP Bug Type: Strings related
Bug description: Comparison with zero (0) returns TRUE
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 bug report at: http://bugs.php.net/?id=12876&edit=1
Thread (4 messages)
- ash at freaky-namuh dot com