Re: 'undef' as an argument value
| From: | Alan McFarlane | Date: | Tue, 12 Mar 2002 01:00:34 +0000 |
| Subject: | Re: 'undef' as an argument value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88129@lists.php.net to get a copy of this message | ||
function foo( $arg1, $arg2 = null )
{
.. as before ..
}
--
Alan McFarlane
Rodent Of Unusual Size <Ken.Coar@Golux.Com> wrote in message
news:3C8D1ED4.2E1C8C48@Golux.Com...
> An odd request.. I want to have optional function arguments
> that *aren't* defined unless values are explicitly passed. Sorta
> the equivalent of
>
> function foo($arg1_required, $arg2_optional=undef)
> if (isset($arg2_optional)) {
> print "explicit";
> }
> else {
> print "not passed";
> }
> }
>
> Something like this is possible in Perl through the 'undef'
> construct; is anything like this available in PHP?
> --
> #ken P-)}
>
> Ken Coar, Sanagendamgagwedweinini http://Golux.Com/coar/
> Author, developer, opinionist http://Apache-Server.Com/
>
> "Millennium hand and shrimp!"