AW: [PEAR-DEV] Re: [PEAR-QA] Re: [PEAR-DEV] Re: common error handling problem -
| From: | Stephan Schmidt | Date: | Thu, 31 Jul 2003 22:55:54 +0000 |
| Subject: | AW: [PEAR-DEV] Re: [PEAR-QA] Re: [PEAR-DEV] Re: common error handling problem - | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19112@lists.php.net to get a copy of this message | ||
Hi,
> in php4 it is only possible to let 'the last' parameters be optional
> you can't do something like that:
>
> function error($message = "unknown", $code, ...)
> {
> // some nice lines
> }
>
> only this works:
>
> function error($code, $message = "unknown")
> {
> // some nicer lines
> }
The first example will never be possible, neither in PHP4 nor in PHP5.
It may be possible to use it with three parameters, but think of
something linke this:
function foo($arg1 = "", $arg2, $arg3 = "", $arg4 = "")
{
}
foo( 1,2,3 );
which value should be stored in which variable? impossible to decide...
Normally you do this by using an array is a parameter. There you can
leave out any option and the function checks which options are set and
which have to be set to their default values.
Stephan