Req #73550 [Sus]: PHP Function Call Proposal
| From: | requinix@php.net | Date: | Thu, 17 Nov 2016 05:58:43 +0000 |
| Subject: | Req #73550 [Sus]: PHP Function Call Proposal | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205428@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73550&edit=1
ID: 73550
Updated by: requinix@php.net
Reported by: zartashzulfiqar at gmail dot com
Summary: PHP Function Call Proposal
Status: Suspended
Type: Feature/Change Request
Package: *General Issues
Operating System: All
PHP Version: 7.1.0RC6
Block user comment: N
Private report: N
New Comment:
Forgot the link. https://wiki.php.net/rfc/named_params
Previous Comments:
------------------------------------------------------------------------
[2016-11-17 05:58:05] requinix@php.net
See the Named Parameters RFC (currently inactive)
------------------------------------------------------------------------
[2016-11-16 22:32:48] zartashzulfiqar at gmail dot com
Description:
------------
function myFunction($var1, $var2=3, $var3=4, $var4=5) {
echo $var1."\n".$var2."\n".$var3."\n".$var4;
}
Test script:
---------------
myFunction('Test Call', 3, 4, 10);
Expected result:
----------------
I expect this Output:
Test Call
3
4
10
Actual result:
--------------
Actual Same:
Test Call
3
4
10
But Issue is:
Now see that I only want to change $var4 value in my function. All other default values will remain
same. But I have to remember every value and pass it through the function.
I am proposing a this change like this:
myFunction('Default Value', $var4=10);
so that Every developer can only pass value with specific variable name. This issue arises at many
function when we used in our development. I think this change will be a big feature for developer.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73550&edit=1