|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73550 PHP Function Call Proposal
Submitted: 2016-11-16 22:32 UTC Modified: 2016-11-17 05:58 UTC
From: zartashzulfiqar at gmail dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 7.1.0RC6 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-11-16 22:32 UTC] zartashzulfiqar at gmail dot com
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

Actual result:
Actual Same:
Test Call

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-17 05:58 UTC]
-Status: Open +Status: Suspended
 [2016-11-17 05:58 UTC]
See the Named Parameters RFC (currently inactive)
 [2016-11-17 05:58 UTC]
Forgot the link.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 11:01:22 2020 UTC