ID: 29863
Updated by: [EMAIL PROTECTED]
Reported By: viraptor at sol dot wsiz dot rzeszow dot pl
-Status: Open
+Status: Wont fix
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 5.0.1
New Comment:
You can only use constants as defaults for parameters to functions,
this is not going to be changed.
Previous Comments:
------------------------------------------------------------------------
[2004-08-27 12:31:42] viraptor at sol dot wsiz dot rzeszow dot pl
Description:
------------
When started using php 5 I tried to do something like this:
class A {
private $var;
function B($arg = $this->var) { ... }
}
Got 'unexpected T_VARIABLE' or course, but I think it would be a nice
option to add in a future releases - default arguments computed when
function is called. It could be especially useful when used inside
classes.
Probably the same as bug #6566, but if it disappeared after php3, it
certainly should be turned on again in php5
Expected result:
----------------
Compute default arguments when calling a function, that can create
those itself. It will help if you need something like:
function A ($arg = NULL) {
if($arg == NULL) $arg=$another_arg;
.....
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29863&edit=1