Re: Problem with pass-by-ref
| From: | Andi Gutmans | Date: | Sun, 19 Nov 2000 21:19:21 +0000 |
| Subject: | Re: Problem with pass-by-ref | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-38518@lists.php.net to get a copy of this message | ||
At 10:09 PM 11/19/00 +0100, André Langhorst wrote:
Hi Andi, there are 2 major problems regarding your patch... 1)We need to check this out.bar(foo()); // This will work now. bar(new foobar()); // Should work. bar(5); // Won't work bar($a = 5) // Won't work.the third+fourth both DO work!
Please check if your code which broke due to our previous patch with afoo() should return a reference. Defint it as: function &foo() { } Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/"Only variables can be passed by reference" is OK now (unless your code was really broken :)2) broken again (not mine), the patch... it only happens inside classes AFAIK <?php function foo() {$i=1; return $i; }$foo = new foobar(); class foobar {function foobar() { $this->bar($this); // works $this->bar(foo()); // not }function bar(&$blah) { print "Hey, what's wrong?"; } }?>