> I have a conditional:
 > if (a == b)
 >
 > a is the number 0, but b is a string "Friday August 22".
 >
 > The condition is evaluating as true, which is not what I want.
 > What am I misunderstanding?

You're comparing a string to a number perhaps?

I tried this:

-----8<-----
$a = 0;
$b = "Friday August 22";

if ($a == $b)
{
  echo "match";
} else {
  echo "no match";
}
-----8<-----

and resulted in 'match', then I tried this:

-----8<-----
$a = "0";
$b = "Friday August 22";

if ($a == $b)
{
  echo "match";
} else {
  echo "no match";
}
-----8<-----

and resulted in 'no match'.

It's worth remembering that the number 0 has somewhat special meaning in
php as a true/false indication.

CYA, Dave





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

Reply via email to