php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20706 skipping an optional argument
Submitted: 2002-11-28 15:21 UTC Modified: 2010-12-31 23:57 UTC
Votes:6
Avg. Score:4.3 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jeremyirons at genevus dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.2.3 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-11-28 15:21 UTC] jeremyirons at genevus dot com
Any reason why the following has never been implemented for optional function arguments?

function test($a, $b = 1, $c = 2)
{
//do something
}

test("hello",,7);

What I would like the test function to see would be
$a = "hello"
$b = 1
$c = 7

Since I skipped the second argument, I would like the default value to kick in. This would be really useful!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-31 23:57 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-12-31 23:57 UTC] jani@php.net
Use arrays for something like this. No way this should be ever implemented, that looks just like a typo instead of intentionalö.
 [2010-12-31 23:57 UTC] jani@php.net
-Package: *General Issues +Package: Scripting Engine problem
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 02:01:23 2020 UTC