Re: Only variables or references can be returned by reference

From: Date: Mon, 12 Jan 2004 16:12:25 +0000
Subject: Re: Only variables or references can be returned by reference
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-6994@lists.php.net to get a copy of this message
On Mon, Jan 12, 2004 at 06:06:22PM +0200, Andi Gutmans wrote: > At 10:39 AM 1/12/2004 -0500, Daniel Convissor wrote: > >On Mon, Jan 12, 2004 at 09:05:12AM +0200, Andi Gutmans wrote: > >> > >> b) A function which returned a variable by reference couldn't be returned > >> by reference. I think this one is probably OK to code. > > > >But, does this cause memory corruption problems in PHP 4? > > If it's returned by reference consistently then I believe it doesn't. I'm uncertain what you mean. For example, I'm guessing this is NOT okay? function &foo() { $x = 1; return $x; } function &bar() { return foo(); } function blah() { // problem in PHP 4 because this isn't returning by reference? return foo(); } Thanks, --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.internals (#6994) next »