Bug #12809 Updated: function calls, default arguments and passing references

From: Date: Fri, 17 Aug 2001 13:26:41 +0000
Subject: Bug #12809 Updated: function calls, default arguments and passing references
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-63522@lists.php.net to get a copy of this message
ID: 12809 Updated by: derick Reported By: anders@gatefive.fi Old Status: Open Status: Suspended Bug Type: Feature/Change Request Operating System: linux 2.2 PHP Version: 4.0.4pl1 New Comment: Default referenced variabeles are not yet supported. They probably will be in the second release of the Zend engine. Suspending for now. Derick Previous Comments: ------------------------------------------------------------------------ [2001-08-17 09:17:50] anders@gatefive.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 http://bugs.php.net/?id=12809&edit=1

« previous php.dev (#63522) next »