|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-27 13:16 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 20:00:02 2025 UTC |
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; ..... }