Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13665 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33076 invoked by uid 1010); 1 Nov 2004 14:58:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32921 invoked from network); 1 Nov 2004 14:58:53 -0000 Received: from unknown (HELO mail.communityconnect.com) (209.10.169.57) by pb1.pair.com with SMTP; 1 Nov 2004 14:58:53 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.communityconnect.com (Postfix) with ESMTP id D39847178C for ; Mon, 1 Nov 2004 10:07:36 -0500 (EST) Received: from mail.communityconnect.com ([127.0.0.1]) by localhost (cc18-2.web.gbx.ccops.us [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22706-14 for ; Mon, 1 Nov 2004 10:07:31 -0500 (EST) Received: from unix-101-34.hq.communityconnect.com (cc240-0.web.gbx.ccops.us [10.30.0.240]) by mail.communityconnect.com (Postfix) with ESMTP id 9D6D071785 for ; Mon, 1 Nov 2004 10:07:31 -0500 (EST) Reply-To: john@coggeshall.org To: internals@lists.php.net In-Reply-To: <41864BCA.5050701@prohost.org> References: <418294D9.4070700@prohost.org> <20041029193421.9557.qmail@pb1.pair.com> <5.1.0.14.2.20041029162045.0439b9c0@localhost> <20041031093753.74166.qmail@pb1.pair.com> <42285846.20041031233522@marcus-boerger.de> <41856AEF.4060501@php.net> <4e89b426041031172932ada70f@mail.gmail.com> <1152524831.20041101030445@marcus-boerger.de> <24e5f3b7041031220372d44413@mail.gmail.com> <41864BCA.5050701@prohost.org> Content-Type: text/plain Message-ID: <1099321127.5978.1.camel@unix-101-34.hq.communityconnect.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Mon, 01 Nov 2004 09:58:47 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mail.communityconnect.com Subject: Re: [PHP-DEV] Re: Negative string offset support From: john@coggeshall.org (John Coggeshall) I honestly don't really care about the performance side of things, I'd be very surprised if this sort of calculation is going to be in the top 5 bottlenecks of an application. However, from a development point of view I do find $a{-1} a much shorter and cleaner way of calculating an end-of-string offset and would like to see it implemented. On Mon, 2004-11-01 at 09:44, Ilia Alshanetsky wrote: > IMO {-1} syntax is not only faster but simpler to use then the > equivalent substr() (for read) or $a[strlen($a) - 1] (for write). While > my reasons are primarily performance based, I think that most people > would find the {-1} simpler to use as well. > > Ilia > > Sterling Hughes wrote: > > i hope not. this should be about what's cool for developers, the > > speed increase is not a compelling reason.. the debate is "does this > > make code easier to read/write/maintain?" I think it doesn't, and > > therefore am against it. > > > > -sterling > > > > > > On Mon, 1 Nov 2004 03:04:45 +0100, Marcus Boerger wrote: > > > >>Hello Wez, > >> > >> well it would. However 5.1 aims to be a major speed improvement and that's > >>what the idea is about. > >> > >>best regards > >>marcus > >> > >> > >> > >>Monday, November 1, 2004, 2:29:46 AM, you wrote: > >> > >> > >>>Doesn't substr($a, -1) work ? > >> > >>>--Wez. > >> > >>>On Sun, 31 Oct 2004 17:45:03 -0500, Greg Beaver wrote: > >>> > >>>>It would reduce the errors I inevitably get > >>>>whenever using a complex feature like substr(). The three choices: > >>>> > >>>>1) substr($a, strlen($a) - 1); > >>>>2) $a{strlen($a) - 1} > >>>>3) $a{-1} > >>>> > >>>>It's pretty obvious that the 3rd choice lowers the potential for all > >>>>kinds of bugs (mistypign, wrong parameter name, incorrect parameter > >>>>placement), and is much more readable. For those who already know how > >>>>{} works in PHP, it's also obvious what it does at the first look > >>>>without any speculation. > >> > >>-- > >>Best regards, > >> Marcus mailto:helly@php.net > >> > >>-- > >>PHP Internals - PHP Runtime Development Mailing List > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > >