Re: Method writing quesion
| From: | Jeff Sheltren | Date: | Fri, 08 Feb 2002 19:24:38 +0000 |
| Subject: | Re: Method writing quesion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84030@lists.php.net to get a copy of this message | ||
I would actually do the check inside the function, that way you don't have to do it each time before you call the function. Also, by doing this you can set things to a default value (if that is relevant to your code...).
-Jeff
At 08:20 PM 2/8/2002 +0100, Nick Wilson wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi everyone,quick Q on writing Methods on PHP:If a methods purpose is to take 3 values and do stuff with those values, should the error checking (eg. that the values dont='') be done /inside/ the Method or by the script that calls it? It makes more sense to me to have all the error checking and validation done /before/ passing it to the method as one of the concepts of classes is that their methods are very simple and specific. However, I wondered what you all thought on this? - -- Nick Wilson