* Thus wrote Richard Baskett ([EMAIL PROTECTED]):
> on 10/1/03 8:23 PM, Gerard Samuel at [EMAIL PROTECTED] wrote:
> 
> > I've noticed code written in this order ->
> > if (FALSE === $foo)
> > {
> >   // yada yada
> > }
> > 
> > Is there a reason/benefit to test variables like that instead of ->
> > if ($foo === FALSE)
> > {
> >   // yada yada
> > }
> > 
> > Thanks
> 
> I think it's more to catch errors.. for example.. if I typed this:
> 
> if ($foo = FALSE)
> 
> You will not get an error since you are assigning $foo the value of FALSE
> 
> while if you did this:
> 
> if (FALSE = $foo)
> 
> PHP will throw up an error because you can not assign FALSE the value of
> $foo :)
> 
> That's the only reason that I can think of.

Yep.  Just make sure you dont start speaking english like that,
people will look at you funny, or think your yoda :)

if ('away' == $put_your_weapon) {
  $harm = false;
}
/* Away put your weapon, I mean you no harm */

or 
if ( 'help' == $you_can )  {
  hmm();
}
/* Help you can, Hmm! */

Or more popular:

if ($do || false == $do ) {
  try();
}
/* Do, or do not. There is no try. */



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to