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?
---
$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) ...
>
&
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
, 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 Mail
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
> 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
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.ne
7 matches
Mail list logo