[drupal-devel] What the difference between '==' and '==='

Gordon Heydon gordon at heydon.com.au
Wed Mar 30 13:31:00 UTC 2005


Hello,

Thanks for this, but I am not sure why everything was marked as
selected.

Gordon.

On Wed, 2005-03-30 at 15:05 +0200, Carl McDade wrote:
> 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.
> 
> !DSPAM:424aa545181922564531397!
> 
-- 
Gordon Heydon <gordon at heydon.com.au>




More information about the drupal-devel mailing list