Re: Comparison Operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell
<Russell.Chadwick@xxxxxxxxxxxxxxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux