Re: Function arguments
| From: | Mike Migurski | Date: | Fri, 15 Aug 2003 18:17:17 +0000 |
| Subject: | Re: Function arguments | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159742@lists.php.net to get a copy of this message | ||
>What is the best way to pass the arguments so it is easy to maintain in
>future if function behaviour changes by adding/removing one or more
>arguments?
>
>Currently i am passing arguments in array. But i think it is not the
>clean way to do it and another approach i am using is functionName(arg1,
>arg2='', arg3='') but here again i think it is not easy to maintain.
According to http://php.net/manual/en/functions.arguments.php,
Variable-length argument lists
PHP 4 has support for variable-length argument lists in
user-defined functions. This is really quite easy, using the
func_num_args(), func_get_arg(), and func_get_args() functions.
No special syntax is required, and argument lists may still be
explicitly provided with function definitions and will behave as normal.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html