Re: Comparison Operator

From: Date: Mon, 10 Jan 2005 19:41:32 +0000
Subject: Re: Comparison Operator
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206005@lists.php.net to get a copy of this message
On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell <Russell.Chadwick@infrastructuredev.com> wrote: > > Could anyone tell me why this code echos? > > <?php > $value = 0; > $curval = 'A'; > if ($value == $curval) { > echo "WTH, Over<br>"; > } > ?> The string is converted to an integer when compared with an integer. See this link for more info. http://us3.php.net/manual/en/language.operators.comparison.php Try using === instead. Brad

« previous php.general (#206005) next »