Re: [SMARTY] String equality also matching numeric 0 with key
| From: | Chris Shenton | Date: | Mon, 09 Feb 2004 20:55:26 +0000 |
| Subject: | Re: [SMARTY] String equality also matching numeric 0 with key | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10937@lists.php.net to get a copy of this message | ||
messju mohr <messju@lammfellpuschen.de> writes:
>> {if $var == "count"}
>>
>> it catches that key name, but ALSO catches the index=0 key.
>
> that's php's funny way of typecasting.
>
> 0 == "count" => true
> "0" == "count" => false
> 0 === "count" => false
Ah, many thanks. I actually want the reverse test in my real code, so
I tried the !== operator and it does exactly what I want. Just didn't
see !== nor === mentioned on the Smarty docs for {if}.
Thanks again.