Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60116 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17931 invoked from network); 17 Apr 2012 22:02:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 22:02:54 -0000 Authentication-Results: pb1.pair.com header.from=neufeind@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=neufeind@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 91.184.32.3 as permitted sender) X-PHP-List-Original-Sender: neufeind@php.net X-Host-Fingerprint: 91.184.32.3 mail.speedpartner.de Linux 2.5 (sometimes 2.4) (4) Received: from [91.184.32.3] ([91.184.32.3:39393] helo=mail.speedpartner.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/36-21594-C88ED8F4 for ; Tue, 17 Apr 2012 18:02:53 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.speedpartner.de (Postfix) with ESMTP id 42930B3DAF for ; Wed, 18 Apr 2012 00:02:50 +0200 (CEST) Received: from mail.speedpartner.de ([127.0.0.1]) by localhost (mail.speedpartner.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2-t8r1IfQjJ for ; Wed, 18 Apr 2012 00:02:50 +0200 (CEST) Received: from collab.speedpartner.de (collab.speedpartner.de [91.184.32.10]) by mail.speedpartner.de (Postfix) with ESMTP id 2DB39B3DAC for ; Wed, 18 Apr 2012 00:02:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by collab.speedpartner.de (Postfix) with ESMTP id E13DACB9DCB for ; Wed, 18 Apr 2012 00:02:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at collab.speedpartner.de Received: from collab.speedpartner.de ([127.0.0.1]) by localhost (collab.speedpartner.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oi3LTcPkB0mp for ; Wed, 18 Apr 2012 00:02:47 +0200 (CEST) Received: from [192.168.4.20] (ip-62-143-28-82.unitymediagroup.de [62.143.28.82]) by collab.speedpartner.de (Postfix) with ESMTPSA id 6F072CB9DCA for ; Wed, 18 Apr 2012 00:02:47 +0200 (CEST) Message-ID: <4F8DE877.1010600@php.net> Date: Wed, 18 Apr 2012 00:02:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: php-dev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Variable-length args by reference From: neufeind@php.net (Stefan Neufeind) Hi, the topic of variable argument-lists for functions in connection with getting the parameters by reference came up. This is currently not possible with func_get_args(), though a "hack" with debug_backtrace() is possible. How would you think about extending func_get_args() and func_get_arg() to allow for: $args = func_get_args(FUNC_GET_ARGS_BY_REFERENCE); $arg0 = func_get_arg (0, FUNC_GET_ARGS_BY_REFERENCE); (default would be FUNC_GET_ARGS_BY_COPY) Currently only the following "hack" works: function calc() { $d = debug_backtrace(); $args = $d[0]['args']; $args[0] *= 2; $args[1] *= 2; } $a = 5; $b = 7; var_dump ($a, $b); calc(&$a, &$b); var_dump ($a, $b); Kind regards, Stefan