Re: Correct Coding
| From: | Jim Lucas | Date: | Thu, 07 Aug 2003 18:39:39 +0000 |
| Subject: | Re: Correct Coding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158715@lists.php.net to get a copy of this message | ||
Good point.
Would not have seen it that way.
Thanks for the tip.
Jim Lucas
----- Original Message -----
From: "Roger B.A. Klorese" <rogerk@queernet.org>
To: "'Jim Lucas'" <phplist@zonedzero.net>; "'Curt
Zirzow'"
<curt@zirzow.dyndns.org>; <php-general@lists.php.net>
Sent: Thursday, August 07, 2003 11:03 AM
Subject: RE: [PHP] Correct Coding
> > Could you explain a little better why this would make things better?
> >
> > I don't understand how this would improve things.
>
>
> > > Concerning the $Task == "Add", I'd like to make a comment. It can
> > > be a wise decision to compare your variables with strings like:
> > >
> > > if ("Add" == $Task)
> > >
> > > This can help preventing typo's like:
> > >
> > > if ($Task = "Add")
>
> $Task = "Add" (typo'd for $Task == "Add") would assign the value,
> clearly not your intent.
>
> "Add" = $Task would be an illegal assignment to a constant, so your
> error would be detected.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>