Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62649 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98785 invoked from network); 2 Sep 2012 01:35:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 01:35:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.113 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.113 smtp113.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.113] ([67.192.241.113:53024] helo=smtp113.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/CD-17065-9F7B2405 for ; Sat, 01 Sep 2012 21:35:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp11.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 6D176D0F0D; Sat, 1 Sep 2012 21:35:50 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp11.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 2136ED0939; Sat, 1 Sep 2012 21:35:50 -0400 (EDT) Message-ID: <5042B7F5.7030409@sugarcrm.com> Date: Sat, 01 Sep 2012 18:35:49 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: "slevy1@pipeline.com" CC: "internals@lists.php.net" References: <13095916.1346546580825.JavaMail.root@wamui-haziran.atl.sa.earthlink.net> In-Reply-To: <13095916.1346546580825.JavaMail.root@wamui-haziran.atl.sa.earthlink.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Support negative indexes for arrays and strings From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > The idea was originally proposed by Marc Easen who created a patch > and asked for help with putting together an RFC. I have yet to see a > formal proposal but on the list Easen modified his idea so that it > should apply to strings alone. With that in mind, would it really > cause problems to have code like this: > > $string = "Roses are red"; $string[-3] = "R"; // modifying > $string[10] echo $string; // Roses are Red I see how this may work for strings and simple vectors, but what about this: $a = array(-1 => "foo", -2 => "bar"); echo $a[-1]; It should keep returning "foo", right? So then the question is - what $array[-1] actually means? Right now I'm not sure I understand it. I guess if somebody wrote an RFC on that it'd make understanding it easier. I see that the patch seems to address just the string part - but the subject also mentions arrays. I think making it clear would be helpful. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227