Re: Re: blank function parameters
| From: | Jordi Canals | Date: | Thu, 04 Nov 2004 00:04:44 +0000 |
| Subject: | Re: Re: blank function parameters | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201107@lists.php.net to get a copy of this message | ||
On 3 Nov 2004 16:38:39 -0000, Matthew Weier O'Phinney
<matthew@garden.org> wrote:
> * Daniel Schierbeck <dasch@ulmail.net>:
>
> > function foobar ($a, $b, $c = null)
> > {
> > if (isset($c)) {
> > echo 'The third argument was set';
> > }
> > }
>
> That check should be for 'is_null($c)' as the default value of $c will
> be null, and it will be always set, even if not sent.
>
The example above is correct ... you can check with isset($c) and
always will return false, as the manual says: " isset() will return
FALSE if testing a variable that has been set to NULL. "
Regards,
Jordi.