Re: Is this a PHP bug?
| From: | David Collard | Date: | Sun, 16 Oct 2005 15:46:54 +0000 |
| Subject: | Re: Is this a PHP bug? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26411@lists.php.net to get a copy of this message | ||
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 heading home now but look forward to your explanations tomorrow. PS Incidently, to 'fix' it so it behaves as it should, you can code: if ($x.'' == $y.'') echo 'this will not print and all is good.'; Regards .. Rossthere is some stuff about it here: http://us2.php.net/manual/en/language.types.boolean.php sorry if this posted twice :p