Re: Comparison Operator

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

 



Chadwick, Russell  wrote / napísal (a):


Could anyone tell me why this code echos?

<?php
$value = 0;
$curval = 'A';
if ($value == $curval) {
 echo "WTH, Over<br>";
}
?>



Try ===

If you use ==
$value is compared to $curval
$value is integer so
php converts $curval to integer
so it contains no digtis so
it assumes that $curval=0;
why it is.




trobi

--
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