Re: real optional parameters
| From: | Papp Gyozo | Date: | Wed, 29 Aug 2001 14:07:56 +0000 |
| Subject: | Re: real optional parameters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65020@lists.php.net to get a copy of this message | ||
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: <alvarez@sto13.st-oneline.de>
To: <php-general@lists.php.net>
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 <alvarez@st-oneline.net>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>