Re: [PHP] if (a == b) ...

2003-01-30 Thread Ernest E Vogelsinger
At 02:36 30.01.2003, Webapprentice said: [snip] >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? ---

RE: [PHP] if (a == b) ...

2003-01-29 Thread Lee Herron
$a === $b TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) > -Original Message- > From: David Freeman [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 29, 2003 7:39 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] if (a == b) ... > &

Re: [PHP] if (a == b) ...

2003-01-29 Thread Webapprentice
Cal, Thanks for the suggestion. I looked up equality on www.php.net, and there are many comments about how == works. I also found out === works too, or is that still lazy? Thanks, Stephen Cal Evans wrote: Stephen, "Friday August 22" evaluates to the number 0. (check the docs for intval()) The

RE: [PHP] if (a == b) ...

2003-01-29 Thread Cal Evans
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.

Re: [PHP] if (a == b) ...

2003-01-29 Thread Johannes Schlueter
On Thursday 30 January 2003 02:39, David Freeman wrote: > -8<- > $a = "0"; > $b = "Friday August 22"; > -8<- > > and resulted in 'no match'. Or try $a = 0; $c = (string) $a; // Now $c == "0" or if (( (string) $a == (string) $b)) { ... The manual could be your friend, to

RE: [PHP] if (a == b) ...

2003-01-29 Thread David Freeman
> 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 = "Frid