Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13605 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83185 invoked by uid 1010); 29 Oct 2004 20:14:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83123 invoked from network); 29 Oct 2004 20:14:17 -0000 Received: from unknown (HELO utopia.rusko.us) (207.44.144.89) by pb1.pair.com with SMTP; 29 Oct 2004 20:14:17 -0000 Received: from rusko (ool-44c0a1af.dyn.optonline.net [68.192.161.175]) by utopia.rusko.us (Sendmail) with SMTP id 6D4F9BBBAD for ; Fri, 29 Oct 2004 16:14:16 -0400 (EDT) Message-ID: <034401c4bdf3$b5c00760$0200a8c0@rusko> To: References: <418294D9.4070700@prohost.org> Date: Fri, 29 Oct 2004 16:13:01 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Subject: Re: [PHP-DEV] Negative string offset support From: paul@rusko.us ("Paul G") ----- Original Message ----- From: "Ilia Alshanetsky" To: Sent: Friday, October 29, 2004 3:07 PM Subject: [PHP-DEV] Negative string offset support > I am wondering what are people's opinions on adding support for negative > string offsets that could be used to access data from the end of a string. > > Ex. $a = "123"; echo $a[-1]; // would print 3 > > I don't think we should do this for arrays, since -1 and similar are > valid array keys, which means adding this support for arrays would break BC. this, coupled with splicing, is very useful in python. i believe it would be very useful in php as well. agree with sterling's suggestion - it would enable all of the functionality, rather than some. paul