Re: 'undef' as an argument value

From: Date: Tue, 12 Mar 2002 10:51:51 +0000
Subject: Re: 'undef' as an argument value
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-88176@lists.php.net to get a copy of this message
function foo ($arg1_required, $arg2_options = "") { if (empty($arg2_optional) { print "not passed"; } else { print "explicit"; } } Or you can go the other route. Jordan "Rodent Of Unusual Size" <Ken.Coar@Golux.Com> wrote in message news:3C8D209D.289F8DAA@Golux.Com... > Rick Emery wrote: > > > > function foo($arg1_required, $arg2_optional="") > > if ($arg2_optional=="") { > > print "not passed"; > > } > > else { > > print "explicit"; > > } > > } > > No, I said 'undef' because I mean 'undefined'. The argument > can have *any* value; I need to know when it has *none*. That > is, there is no magic cookie to which I can set the default that > might not be a valid call value. > -- > #ken P-)} > > Ken Coar, Sanagendamgagwedweinini http://Golux.Com/coar/ > Author, developer, opinionist http://Apache-Server.Com/ > > "Millennium hand and shrimp!"

« previous php.general (#88176) next »