Passing by reference

From: Date: Mon, 27 Nov 2000 18:54:55 +0000
Subject: Passing by reference
Groups: php.dev php.qa 
Request: Send a blank email to php-dev+get-39310@lists.php.net to get a copy of this message
Hi, I just commited a patch which lightens up the restrictions Zeev and I introduced a few weeks ago in the CVS tree of passing certain arguments to functions which declare the argument to be passed by reference. It's a big patch so please try and see if it works. If you have a function: function foo(&$a) { } The following can be passed to foo(): a) A variable, i.e. foo($a) b) A new statement, i.e. foo(new foobar()); c) A reference returned from a function, i.e.: function &bar() { $a = 5; return $a; } foo(bar()); All other expressions are undefined and can not be passed by reference. For example: a) function bar() // Note the missing & { $a = 5; return $a; } foo(bar)); b) foo($a = 5); c) foo(5); Please let me know if this solves some of the bugs people have been reporting with the current CVS tree. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#39310) next »