> [EMAIL PROTECTED] wrote: > >> 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.
I dont understand, i assume that would check if name was set, i also set functions like function foo($name,$bar = null) { } so therefore bar doesnt need to be inputted, seeing as i set it to null would i check if $bar===true ? or just isset($bar ) ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php