Re: Optional Vars in Functions

From: Date: Fri, 02 Jan 2004 21:41:34 +0000
Subject: Re: Optional Vars in Functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173653@lists.php.net to get a copy of this message
--- Jason Williard <jason@janix.net> wrote: > Is there a way to make a variable of a function optional? Just give it a default value. Try this example: <? function myfunc($foo = 'bar') { echo "$foo\n"; } myfunc('foo'); myfunc(); ?> Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/

« previous php.general (#173653) next »