Re: [PHP-WIN] Is this a PHP bug?

2005-10-16 Thread Nadim Attari
Ross Honniball wrote: I'm yet to be convinced it isn't a bug. I suspect it is a bug that has been around so long that they can't afford to fix it or it may break many applications that for various peculiar reasons rely on it to behave as it does for their code to work. Read this first htt

Re: [PHP-WIN] Is this a PHP bug?

2005-10-16 Thread Paul Menard
Well per this PHP page: http://us2.php.net/manual/en/language.operators.comparison.php, "If you compare an integer with a string, the string is converted to a number. " So to follow this regarding your example: $x = 0; // Numeric zero $y = 'Some kind of string'; if (is_null($x)) echo "x is NULL

Re: [PHP-WIN] Is this a PHP bug?

2005-10-16 Thread Ross Honniball
I'm yet to be convinced it isn't a bug. I suspect it is a bug that has been around so long that they can't afford to fix it or it may break many applications that for various peculiar reasons rely on it to behave as it does for their code to work. For those who have tried to defend its behavio

Re: [PHP-WIN] Is this a PHP bug?

2005-10-16 Thread David Collard
Ross Honniball wrote: $x = 0; // Numeric zero $y = 'Some kind of string'; if ($x == $y) echo 'they equal using =='; if ($x === $y) echo 'they equal using ==='; The above will echo 'they equal using =='. The values don't look very equal to me. Can anyone explain the logic behind this? I'm he

Re: [PHP-WIN] Is this a PHP bug?

2005-10-16 Thread Paul Menard
No not a bug. Maybe just the loose nut behind the keyboard. :<> Change the assignment for variable $x to: $x="0"; In the first if you are using "==". This will only compare values. As you know the second if "===" compares the value and type. I always try and stay away from "$var = 0" expression

[PHP-WIN] Is this a PHP bug?

2005-10-16 Thread Ross Honniball
$x = 0; // Numeric zero $y = 'Some kind of string'; if ($x == $y) echo 'they equal using =='; if ($x === $y) echo 'they equal using ==='; The above will echo 'they equal using =='. The values don't look very equal to me. Can anyone explain the logic behind this? I'm heading home now but look