Hmm i was checking out a pear class, what about the variables within a function ? like function
foo($name) { if ($name) {
} }
or
foo($name) { if (isset($name)) {
} }
it uses isset on variables coming outside the function
Those examples don't make much sense. Without a default value, if foo() is called without a parameter, then it'll cause an error. So, obviously $name is going to be set. So isset() will always be true. if($name) is a valid check, I guess, since an empty string or zero could be passed and cause that to fail. It'd make more sense to set a default value for $name or check for an actual value instead of just seeing if (boolean)$name is TRUE or FALSE.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php