Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13663 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8206 invoked by uid 1010); 1 Nov 2004 10:47:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8147 invoked from network); 1 Nov 2004 10:47:08 -0000 Received: from unknown (HELO mrelay-c.lmu.ac.uk) (160.9.128.18) by pb1.pair.com with SMTP; 1 Nov 2004 10:47:08 -0000 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-c.lmu.ac.uk with esmtp (Exim 4.43) id 1COZi4-00045k-AB for internals@lists.php.net; Mon, 01 Nov 2004 10:46:48 +0000 Received: from mrelay-c.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-c [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15072-02 for ; Mon, 1 Nov 2004 10:46:43 +0000 (GMT) Received: from lis-exchange3.lmu.ac.uk ([160.9.35.5]) by mrelay-c.lmu.ac.uk with esmtp (Exim 4.43) id 1COZhR-00043I-LX for internals@lists.php.net; Mon, 01 Nov 2004 10:46:09 +0000 Received: by lis-exchange3.lmu.ac.uk with Internet Mail Service (5.5.2653.19) id ; Mon, 1 Nov 2004 10:45:57 -0000 Message-ID: <0EEFC4D3CBE8A142868E396381B77A53D1278D@lis-exchange3.lmu.ac.uk> To: internals@lists.php.net Date: Mon, 1 Nov 2004 10:45:54 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] Re: Negative string offset support From: M.Ford@leedsmet.ac.uk ("Ford, Mike") To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 30 October 2004 02:03, Andi Gutmans wrote: > Nah that patch won't do because it'll effect [] also. > It's more complicated than that. I've tried separating them in the > past and it was annoying (and didn't have time to finish it off). Well, according to the docs, the [] syntax is deprecated -- *if* the []and {} syntaxes are fully separated, and *if* functionality is added to the {} syntax only, wouldn't this be a good time to emphasize that deprecation and set an actual cutoff for it (such as PHP 6.0?)? Incidentally, I'd be about +100 (if my opinion counted for that much!) for $string{-1}, purely for readability -- any performance gain would be a bonus. > At 05:51 PM 10/29/2004 -0700, Sara Golemon wrote: > > > > > - People might want to take this even further and request {1,3}, > > > {-3,2} and the like. (This was expressed in the past when > > > talking about this stuff) > > > > > They might... and the response to that is that it's a more > > siginificant modification/glut of the exisiting code than merely > > allowing negative offsets. The fact is allowing negative string > > offsets via the {} operator involves changing one line, and it's no > > major waste of CPU cycles. Full substr()esque behavior would be > > more bloat-intensive of course and I'd be inclined to side against > > that. I'd also be +several for folding substr() behaviour into the {} string syntax -- I've often thought that if I ever have time to muck about with the source, I'd like to make that my first little project. (Incidentally, re another post, I'd expect $string{$m, $l} to be the substring clone, and $string{$m:$n} to be "from offset $m to offset $n" syntax -- and, personally, I'd like to see both. But then, I'm a programmer with over 20 years experience, so probably not your typical PHP user at all, and I can quite see the argument about not cluttering up PHP with potentially obscure syntaxes. So I'll shut up now! ;) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211