#23439 [WFx]: Allow default values to be passed for functions
| From: | steveh at brendata dot co dot uk | Date: | Thu, 01 May 2003 14:49:07 +0000 |
| Subject: | #23439 [WFx]: Allow default values to be passed for functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38886@lists.php.net to get a copy of this message | ||
ID: 23439
User updated by: steveh at brendata dot co dot uk
Reported By: steveh at brendata dot co dot uk
Status: Wont fix
Bug Type: Feature/Change Request
Operating System: linux 2.4.20
PHP Version: 4.3.1
New Comment:
Although your suggestion is appropriate for new code upgrading old
libraries and then all the code that calls them makes it impractible
for updates to existing code?
Previous Comments:
------------------------------------------------------------------------
[2003-05-01 09:45:53] derick@php.net
This was submitted before and respectfully declined. If you want to use
something like this, you can either use an array based approach or use
func_get_args().
Derick
------------------------------------------------------------------------
[2003-05-01 09:38:54] steveh at brendata dot co dot uk
It would be useful to be able to omit function arguments and have the
function still use the defaults even though some to the right were
passed:
e.g.
function fred ($a,$b=1,$c=2,$d=3)
{
echo "a=$a,b=$b,c=$c,d=$d";
}
fred(-1);
fred(-1,,4,5);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23439&edit=1