Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72564 invoked from network); 20 Mar 2015 23:03:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 23:03:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.178 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.178 mail-pd0-f178.google.com Received: from [209.85.192.178] ([209.85.192.178:33487] helo=mail-pd0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/64-64120-E37AC055 for ; Fri, 20 Mar 2015 18:03:26 -0500 Received: by pdnc3 with SMTP id c3so121676425pdn.0 for ; Fri, 20 Mar 2015 16:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=1Tr1hYQZa+Gjly6Eyy5DxHx8KMh6fgxAxPlO4BrpLkM=; b=FvJMp2IReVF4jfX7ymOe9KvhZi9FrvPVv3hn64prGoZW+gUBcEEgdsWUHDzlVlfeYx zWQrNCCmTIXLJA5qCK2LgDB6fTvc9/qcHI3UYyYupqP66/kLOIMz7qCss1jZxBGRXuf6 jYuin8PZsMvrMhGdZsmqo6Kt9TwLlDkZPCnsVpF9lganmS3WaxwTMZiSMJnJffXqDo54 0AEItHSu0mT5dcXygYxG7Q3DZFNsKVcRTSiN7fPpMFCtx9/u5Ox9CsQ75i25qP4YWAnH NU+H1QrZC0+KwnrQnSPFEV1yNL11f++3eeU3VVzejl/R0peinCQTdjmbDK2zhVerEiIZ 0PvA== X-Received: by 10.68.172.131 with SMTP id bc3mr511150pbc.107.1426892603719; Fri, 20 Mar 2015 16:03:23 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id sg4sm9811516pac.11.2015.03.20.16.03.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 16:03:22 -0700 (PDT) Message-ID: <550CA73A.2010308@gmail.com> Date: Fri, 20 Mar 2015 16:03:22 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Alex Bowers CC: Christoph Becker , PHP Internals References: <550B5A81.1090706@gmail.com> <550C8879.70002@gmail.com> <550C90EF.7080404@gmx.de> <550C9B39.5080801@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC - Array slice syntactic sugar From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > This may be not so easy to implement - imagine passing $array[*1:4] by > reference. > > > This would be the same as doing > $array[array_keys($old_array)[1]] = $new_array[0]; > $array[array_keys($old_array)[2]] = $new_array[1]; > $array[array_keys($old_array)[3]] = $new_array[2]; > $array[array_keys($old_array)[4]] = $new_array[3]; I don't think you understood what I am saying. Lvalues in PHP can be used not only in assignment context, but also in passing-by-ref context, and in that case I have no idea how you pass $array[*1:4] by reference - what is actually passed? > There is the array_splice method that can do the same thing, however > this to me is less obvious as to what is happening: I don't see any reason why it would be less obvious, if you bother to look at man page of array_splice once. -- Stas Malyshev smalyshev@gmail.com