RE: [PHP] Correct Coding

From: Date: Thu, 07 Aug 2003 18:03:11 +0000
Subject: RE: [PHP] Correct Coding
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158698@lists.php.net to get a copy of this message
> 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.

« previous php.general (#158698) next »