ID: 48444
Updated by: [email protected]
Reported By: oliver dot ridgway at trafford dot ac dot uk
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Windows XP
PHP Version: 5.2.9
New Comment:
# php -r 'var_dump("string" == 0);'
bool(true)
# php -r 'var_dump("string" != 0);'
bool(false)
# php -r 'var_dump("string" === 0);'
bool(false)
# php -r 'var_dump("string" !== 0);'
bool(true)
RTFM: http://www.php.net/manual/en/language.operators.comparison.php
Previous Comments:
------------------------------------------------------------------------
[2009-06-01 12:14:25] oliver dot ridgway at trafford dot ac dot uk
Description:
------------
I can't work out if this a bug or php is working differently than I
expected, so i thought I'd report it just in case.
$var1 is not 0 so why is the if statement saying it is?
Reproduce code:
---------------
<?php
class test {
function __construct($var1) {
print($var1 . " ");
if($var1 == 0) {
print('zero');
}
if($var1 != 0) {
print('not');
}
}
}
$test = new test('string');
?>
Expected result:
----------------
string not
Actual result:
--------------
string zero
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48444&edit=1