Re: Re: Only variables can be passed by reference

From: Date: Sat, 06 Dec 2014 03:03:41 +0000
Subject: Re: Re: Only variables can be passed by reference
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-79452@lists.php.net to get a copy of this message
Hi Rowan, On Fri, Dec 5, 2014 at 6:12 PM, Rowan Collins <rowan.collins@gmail.com> wrote: > The author of function f1() presumably designed it to apply some change to > $v, rather than executing only for its side effects and return value. If > the caller wants to ignore this design, they can, but they are not using > the function as it was designed. If they pass a function return straight > into it, they have no way of capturing the change to $v which the author > intended them to see. The value supplied to f1() is return value. In languages, there are literal, constant and variable. Return value is variable. It's better to keep basic rule. IMHO. $top = array_pop(f2()); is better than $v = f2(); $top = array_pop($v); Is there anyone who likes latter? Are there any other languages behave like PHP? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#79452) next »