RE: [PHP] 'undef' as an argument value

From: Date: Mon, 11 Mar 2002 21:11:42 +0000
Subject: RE: [PHP] 'undef' as an argument value
Groups: php.general 
Request: Send a blank email to php-general+get-88086@lists.php.net to get a copy of this message
function foo($arg1_required, $arg2_optional="") if ($arg2_optional=="") { print "not passed"; } else { print "explicit"; } } -----Original Message----- From: Rodent of Unusual Size [mailto:Ken.Coar@Golux.Com] Sent: Monday, March 11, 2002 3:17 PM To: php-general@lists.php.net Subject: [PHP] 'undef' as an argument value 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!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#88086) next »