[drupal-devel] What the difference between '==' and '==='
Carl McDade
carl_mcdade at yahoo.com
Wed Mar 30 13:05:54 UTC 2005
The values on both sides of = = = have to be identical. There is no
conversion by PHP as when using = =.
$var = "123";
$var === 123; //false
$var == 123; //true
Carl McDade
Gordon Heydon wrote:
> Hello,
>
> I was just doing some work, and work some reason the form_select would
> select every thing.
>
> Here is what I coded.
>
> form_select('', 'result][' .$payment->txnid, '', array('' => t('select
> result'), '1' => t('cleared'), '0' => t('dishonoured'))
>
> And for some reason every option was selected.
>
> I changed line 1329 in common.inc from ($value == $key ? '
> selected="selected"' : '')) to ($value === $key ? '
> selected="selected"' : '')) and it started working.
>
> Is my form_select call wrong, or is there some difference between ==
> and
> ===
>
> Thanks.
More information about the drupal-devel
mailing list