Re:Strange 'if' test bug?
| From: | william.candillon@tiscali.fr | Date: | Tue, 31 Aug 2004 10:30:54 +0000 |
| Subject: | Re:Strange 'if' test bug? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-24471@lists.php.net to get a copy of this message | ||
According to me it's a very strange problem
Test this please :
$key = '0';
if($key == 'muppet')
echo 'key is a muppet: ".$key;
else
echo 'key is something else: '.$key;
Because I don't understang why $key return false :(
---------- Initial Header -----------
From : "Steve McGill" <steve@bluearena.com>
To : php-windows@lists.php.net
Cc :
Date : Tue, 31 Aug 2004 10:35:01 +0200
Subject : [PHP-WIN] Strange 'if' test bug?
Sorry if this is a newbie FAQ,
<?php
$key=0;
if($key == "muppet") {
echo "key is a muppet: $key";
} else {
echo "key is something else: $key";
}
?>
Will print completely the wrong line:
====> key is a muppet: 0
If I use three equals signs, i.e. ===, then the test works.
But if I use linux, the test works as expected with two equals signs.
What on earth am I missing?
Using Windows PHP 4.3.8 as a CGI, on Apache 1.3.31.
Many thanks in advance for any help,
Steve
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
************************ ADSL ILLIMITE TISCALI + TELEPHONE GRATUIT ************************
Surfez 40 fois plus vite pour 30EUR/mois seulement ! Et téléphonez partout en France
gratuitement,
vers les postes fixes (hors numéros spéciaux). Tarifs très avantageux vers les mobiles et
l'international !
Pour profiter de cette offre exceptionnelle, cliquez ici : http://register.tiscali.fr/adsl (voir conditions sur le
site)