Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13652 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13812 invoked by uid 1010); 1 Nov 2004 01:29:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13741 invoked from network); 1 Nov 2004 01:29:46 -0000 Received: from unknown (HELO mproxy.gmail.com) (216.239.56.245) by pb1.pair.com with SMTP; 1 Nov 2004 01:29:46 -0000 Received: by mproxy.gmail.com with SMTP id w67so53400cwb for ; Sun, 31 Oct 2004 17:29:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=YMfB/ZLmCA8cH2votv0wlgmMsGAdj9mYocChiJfjLeKpnxZZQ8rTzJBoPeVNh6Z8oalNQqKU7E4Lx/wKjokkQ3oE4YNSJPUxwCkE2ZKRTD5HqzeUkT9jYM3CWSHY7NM/BwZR6VBwQhvNEulT2lMP21gHPUTsozNSubgxkMeKKbE= Received: by 10.11.119.66 with SMTP id r66mr105371cwc; Sun, 31 Oct 2004 17:29:46 -0800 (PST) Received: by 10.11.117.13 with HTTP; Sun, 31 Oct 2004 17:29:46 -0800 (PST) Message-ID: <4e89b426041031172932ada70f@mail.gmail.com> Date: Sun, 31 Oct 2004 20:29:46 -0500 Reply-To: Wez Furlong To: Greg Beaver Cc: internals@lists.php.net In-Reply-To: <41856AEF.4060501@php.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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> Subject: Re: [PHP-DEV] Re: Negative string offset support From: kingwez@gmail.com (Wez Furlong) 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.