RE: [PHP] Sloppy coding?
| From: | Martin Towell | Date: | Wed, 07 May 2003 04:23:34 +0000 |
| Subject: | RE: [PHP] Sloppy coding? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146619@lists.php.net to get a copy of this message | ||
Supposing $somevar has one of the following values: unset, null, 0, "",
false
the first if() will execute
while the second will only execute for "unset"
hope that clears things up....
-----Original Message-----
From: Shawn McKenzie [mailto:nospam@mckenzies.net]
Sent: Wednesday, May 07, 2003 2:21 PM
To: php-general@lists.php.net
Subject: [PHP] Sloppy coding?
I want to sidestep any pitfalls and try to be a good coder. So what is the
difference between these two:
if(!$somevar){
...do stuff
}
if(!isset($somevar)){
...do stuff
}
If one is bad, then are there any other common pitfalls similar to this that
I should avoid???
Thanks!
Shawn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php