Req #65772 [Asn->Wfx]: Implement "default" as a possible function/method argument value in calls

From: Date: Fri, 14 Sep 2018 15:10:47 +0000
Subject: Req #65772 [Asn->Wfx]: Implement "default" as a possible function/method argument value in calls
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217054@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65772&edit=1 ID: 65772 Updated by: requinix@php.net Reported by: matteo_tassinari_TM at libero dot it Summary: Implement "default" as a possible function/method argument value in calls -Status: Assigned +Status: Wont fix Type: Feature/Change Request Package: Variables related Operating System: Any PHP Version: Irrelevant -Assigned To: stas +Assigned To: Block user comment: N Private report: N New Comment: The RFC was declined. Reading through the discussion, the main issue was that people favored solving the problem with named parameters instead of default values. That is, something like justToTest(b = 5) Previous Comments: ------------------------------------------------------------------------ [2018-09-14 15:04:26] abonnementspaul at gmail dot com Do we have any update on this? I know It's been a while but I would still love to see this implemented. ------------------------------------------------------------------------ [2013-09-27 18:46:12] aharvey@php.net We don't really have a status for "it's in an active RFC", so I guess I'll suspend this and assign it to Stas for now, since it's his RFC. ------------------------------------------------------------------------ [2013-09-27 08:03:01] requinix@php.net Existing RFC for this exact thing: https://wiki.php.net/rfc/skipparams ------------------------------------------------------------------------ [2013-09-27 06:49:33] matteo_tassinari_TM at libero dot it Description: ------------ I think it would be useful if we could use the "default" keyword when passing parameters to a method/function so that the value for the parameter for which "default" is passed automatically takes the defined default value, without need of knowing it. Test script: --------------- For example, consider this: function justToTest($a = 10, $b = 0) { var_dump($a, $b); } justToTest(); justToTest(5); justToTest(default, 5); Expected result: ---------------- The first call should show int 10 int 0 The second call should show int 5 int 0 The third call should show int 10 int 5 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65772&edit=1

« previous php.bugs (#217054) next »