Re: blank function parameters
| From: | Matthew Weier O'Phinney | Date: | Wed, 03 Nov 2004 15:29:09 +0000 |
| Subject: | Re: blank function parameters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201042@lists.php.net to get a copy of this message | ||
* Giles Roadnight <giles@roadnight.name>:
> If I defined a function with 4 parameters but only pass 3 I get an
> error. Is there anyway around this?
>
> I want to be able to set the missing parameter to a default value if it
> is not passed which works ok but How do I get rid of the error message?
Read about functions on php.net. Basically, yes:
function someFunc($arg1, $arg2, $arg3, $arg4 = 'default') {}
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org