RE: Comparison Operator

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

 



[snip]
Could anyone tell me why this code echos?
 
<?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) {
  echo "WTH, Over<br>";
 }
?>
[/snip]

Because it has an echo statement in it. And '==' is not '==='

>From http://us3.php.net/manual/en/language.operators.comparison.php

"If you compare an integer with a string, the string is converted to a
number. If you compare two numerical strings, they are compared as
integers. These rules also apply to the switch statement."

http://us3.php.net/manual/en/language.types.string.php#language.types.st
ring.conversion

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