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

From: Date: Fri, 17 Aug 2001 13:17:50 +0000
Subject: Bug #12809: function calls, default arguments and passing references
Groups: php.dev 
Request: Send a blank email to php-dev+get-63517@lists.php.net to get a copy of this message
From: anders@gatefive.fi Operating system: linux 2.2 PHP version: 4.0.4pl1 PHP Bug Type: Feature/Change Request Bug description: function calls, default arguments and passing references 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 bug report at: http://bugs.php.net/?id=12809&edit=1

« previous php.dev (#63517) next »