Re: Passing by reference

From: Date: Mon, 27 Nov 2000 19:09:43 +0000
Subject: Re: Passing by reference
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-39314@lists.php.net to get a copy of this message
Sure, you can subscribe at zend-cvs-subscribe@zend.com Andi At 19:58 27/11/00 +0100, Derick Rethans wrote:
Hi Andi, is there a way so we can see the zend cvs commit messages? Derick Andi Gutmans wrote: 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/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Derick Rethans ---------------------------------------------------------------------
      PHP: Scripting the Web - www.php.net - derick@php.net
---------------------------------------------------------------------
    JDI Media Solutions - www.jdimedia.nl - d.rethans@jdimedia.nl
     H.v. Tussenbroekstraat 1 - 6952 BL Dieren - The Netherlands
---------------------------------------------------------------------
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#39314) next »