Bug #17076 Updated: Omitting defaulted arguments

From: Date: Tue, 07 May 2002 18:30:38 +0000
Subject: Bug #17076 Updated: Omitting defaulted arguments
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7164@lists.php.net to get a copy of this message
ID: 17076 Updated by: mfischer@php.net Reported By: csaba@alum.mit.edu -Status: Open +Status: Suspended Bug Type: Feature/Change Request Operating System: All PHP Version: 4.2.0 New Comment: This is not one of the easily done changes to the engine and to the language. This has come up before a few times in the past and I suggest participating discussion about this on either php-dev or the engine2 mailing list. Suspending until a final consensus is reach (if not already and I just missed it). Previous Comments: ------------------------------------------------------------------------ [2002-05-07 12:51:59] csaba@alum.mit.edu This is an enhancement request for about the only thing that I can think of offhand that exists in VB that I really miss in PHP: I would like to be able to declare, say, function myFunc ($arg0, $arg1="One", $arg2="Two", $arg3=3) and call it thusly: myFunc ("Hi", , "Mom") In other words, if I omit an argument to a function where the value is defaulted (in our example we are talking about position 1, in addition to position 3), PHP should take the default value instead of complaining. Of course I can always figure out what the default value was in the first place by checking the function definition and plunking it into my call explicitely, but isn't this the same convenience that the current method tries to offer us? This is just a proposal to extend it. Motivation: This comes up frequently for me because I have several functions which take 3 parameters which are normally defaulted, and usually at most one varies. So unless it's the first of the three, I have to fill in extra values that distract from what's going on. Thanks for considering this, Csaba Gabor ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17076&edit=1

« previous php.bugs (#7164) next »