php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24153 Use default parameters in the middle while overriding def parameters at the end
Submitted: 2003-06-12 11:04 UTC Modified: 2003-06-12 12:11 UTC
From: php at electricsurfer dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.2 OS: WIN XP
Private report: No CVE-ID: None
 [2003-06-12 11:04 UTC] php at electricsurfer dot com
Description:
------------
Given:
<?
function myfunc($arg1,$arg2=2,$arg3='',$arg4=false,$arg5=1)
{...}
?>
It would be nice to be able to do this:
<?
myfunc('arg1',5,,true);
?>
Which would keep the default values for arguments 3 & 5 but specify a value for argument 4.

This way, if I ever change the default value of $arg3 from '' to null, I have less code to modify.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-12 12:11 UTC] derick@php.net
This was brought up before and it was decided not to do this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC