yes, you just declare the default value of the arguments such as :
my_function ($first = 'no-value', $second = 0, $third = null )
Note that the default value must be a constant expression and any defaults
should be on the right side of any non-default arguments
or you can achieve the very pretty function-overloading using the funtion
handling function. Check it out:
http://www.php.net/manual/en/function.func-get-arg.php
http://www.php.net/manual/en/function.func-get-args.php
http://www.php.net/manual/en/function.func-num-args.php
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 29, 2001 2:22 PM
Subject: [PHP] real optional parameters
>
> How can I declare optional parameters as used by strpos, substr, etc.
> to specify the offset? I do not want to have to preceed some functions
> with the @-operator, and preceeding all for consistency wouldn't be an
> option, I think. Is it possible at with user-defined functions?
>
> quick help is appreciated. thanks.
>
> D. Alvarez Arribas <[EMAIL PROTECTED]>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]