Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79455 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16708 invoked from network); 6 Dec 2014 11:00:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2014 11:00:25 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.19 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.19 mout.gmx.net Received: from [212.227.15.19] ([212.227.15.19:55269] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/10-14211-7C1E2845 for ; Sat, 06 Dec 2014 06:00:24 -0500 Received: from [192.168.0.100] ([91.67.244.80]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MJSQ7-1Xz92A3QmR-0034TM; Sat, 06 Dec 2014 12:00:09 +0100 Message-ID: <5482E1C1.9030908@gmx.de> Date: Sat, 06 Dec 2014 12:00:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Yasuo Ohgaki , Rowan Collins CC: "internals@lists.php.net" References: <2D560BB1-318F-461F-96CD-BE25C346E14F@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:mxeCHhyknyKNCpYKD4V81NqzFBIu60mgGUR/P0KGHca+WvPt58I My5EOzUgqi2T+Jo1YK453OxKQB23bL6Z12A+EAL/g+tVwnjpgTtT8NXOocjR4lgao73QUAS beu87krGtgbrFBETrPJWpmP+KMywO/wcHcQV38ubltn05XfNb4afVaPANUphKHlTAY0gGPZ ewZViT/OkB06hrtCy8KCQ== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [PHP-DEV] Re: Only variables can be passed by reference From: cmbecker69@gmx.de (Christoph Becker) Yasuo Ohgaki wrote: > 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? IMHO, the first snippet is confusing (the second as well, if $v is not used in the following code). Actually, you don't want to pop the top of the stack, but you want to simply get it without altering the stack at all. Therefore it seems reasonable to use a function called array_top() (or so) which takes its argument by value. -- Christoph M. Becker