Re: Newbie question about good coding practice [isset]
| From: | Larry E . Ullman | Date: | Sat, 05 Jun 2004 19:16:26 +0000 |
| Subject: | Re: Newbie question about good coding practice [isset] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187704@lists.php.net to get a copy of this message | ||
if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset?Yes, if you don't use isset(), you may see notices (errors) if the variable is not set. This depends upon the error reporting settings of the server. However, if you use isset() you won't see notices regardless. Larry