#41142 [Opn->Bgs]: Default parameters for functions

From: Date: Fri, 20 Apr 2007 05:32:15 +0000
Subject: #41142 [Opn->Bgs]: Default parameters for functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111714@lists.php.net to get a copy of this message
ID: 41142 Updated by: johannes@php.net Reported By: flopin at webgarden dot cz -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: any PHP Version: 6CVS-2007-04-20 (snap) New Comment: That was often discussed and isn't planned to be included into PHP. Please see Archives of the internals list for discussions about it. Previous Comments: ------------------------------------------------------------------------ [2007-04-20 00:32:04] flopin at webgarden dot cz Description: ------------ It would be nice to find a way how to explicitly set a name of parameter passed to the function, which has default values for its parameters, so i could change only the values i need to change. It can be bypassed in several ways (arrays, classes etc.), but it allways results in bunches of code, which is not nessesary and makes the program less practical. Bug #17076 suggests a possibility of omitting default parameters, but the solution still requires to keep order of parameters. Reproduce code: --------------- function x($a='AAA', $b='BBB') { print $a; print $b; } x($b='111'); //or any other suitable syntax Expected result: ---------------- AAA111 Actual result: -------------- 111BBB ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41142&edit=1

« previous php.bugs (#111714) next »