Req #12809 [Sus->Csd]: function calls, default arguments and passing references
| From: | nikic@php.net | Date: | Mon, 13 Aug 2012 21:20:34 +0000 |
| Subject: | Req #12809 [Sus->Csd]: function calls, default arguments and passing references | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172587@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=12809&edit=1
ID: 12809
Updated by: nikic@php.net
Reported by: anders at gatefive dot fi
Summary: function calls, default arguments and passing
references
-Status: Suspended
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: linux 2.2
PHP Version: 4.0.4pl1
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Closing as this is supported by now.
Previous Comments:
------------------------------------------------------------------------
[2001-08-17 09:26:41] derick@php.net
Default referenced variabeles are not yet supported.
They probably will be in the second release of the Zend engine. Suspending for now.
Derick
------------------------------------------------------------------------
[2001-08-17 09:17:50] anders at gatefive dot fi
In a class I often use functions like this to get/set variables:
class example {
var $somevar;
function Somevar($arg = NULL) {
if (!is_null($arg))
$this->somevar = $arg;
return $this->somevar;
}
}
Everything is ok, but sometimes I would like to be able to do the same
with references, like so:
class example2 {
var $someobject;
function &Someobject(&$arg = NULL) {
if (!is_null($arg))
$this->someobject = &$arg;
return $this->someobject;
}
}
The second example will throw an parse error, expecting ) after &$arg.
I suppose this isn't an bug, but rather something not implemented or is intensional.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=12809&edit=1