Stephen, "Friday August 22" evaluates to the number 0. (check the docs for intval()) Therefore the condition would be true.
I stated in an earlier thread this week. It is bad for to allow PHP todo your conversions for you. At the least it's lazy, at the most it will cause unpredictable results. (as is your case below.) If you really MUST compare a string and a number, do an explicit cast first. if ($a==intval("Friday August 22")) or if (strval($a)=="Friday August 22") In both cases above, since we are explicitly casting, it is easy to predict the results and explain them. (In the above, the first should be true and the second should be false.) =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -----Original Message----- From: Webapprentice [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 7:36 PM To: [EMAIL PROTECTED] Subject: [PHP] if (a == b) ... Hi, 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? Thanks, Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php