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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jeremyirons at genevus dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC