Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13618 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55225 invoked by uid 1010); 29 Oct 2004 23:57:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55200 invoked from network); 29 Oct 2004 23:57:56 -0000 Received: from unknown (HELO blobule.suds) (66.11.170.154) by pb1.pair.com with SMTP; 29 Oct 2004 23:57:56 -0000 Received: by blobule.suds (Postfix, from userid 501) id 95BEB131BC3; Fri, 29 Oct 2004 19:59:31 -0400 (EDT) To: Derick Rethans Cc: sterling@apache.org, Ilia Alshanetsky , internals@lists.php.net In-Reply-To: References: <418294D9.4070700@prohost.org> <24e5f3b7041029123455d9b570@mail.gmail.com> <1099092569.14993.3.camel@blobule.suds> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: InterJinn Message-ID: <1099094371.14993.11.camel@blobule.suds> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5-4mdk Date: Fri, 29 Oct 2004 19:59:31 -0400 Subject: Re: [PHP-DEV] Negative string offset support From: robert@interjinn.com (Robert Cummings) On Fri, 2004-10-29 at 19:31, Derick Rethans wrote: > On Fri, 29 Oct 2004, Robert Cummings wrote: > > > On Fri, 2004-10-29 at 19:04, Derick Rethans wrote: > > > > > Yeah, [] is for arrays, {} for string indexes though I still think this > > > should not be in, one can use substring for this. Something like a > > > "negative string index" is IMO too much magic. > > > > Just as much magic as the negative start in substr() function. It would > > be consistent with substr() precedent of negative indexes counting > > backward from end of string. > > But substr() is a *function*, that's totally different from a language > construct which should be a generic tool, not a specific one like Ilia > is proposing here. > > > Also, everyone knows functions run slower than operators :) > *cough*bullshit argument*cough* Well for the amount of times you need to traverse backward in a string it probably is a crap argument :) However it does indeed stand that operators are processed faster than functions I would wager due to the overhead of setting up parameters etc. Contrast is_null( $x ) versus $x === null, there's about 17% difference in speed. Similarly (0.0 + $x) takes almost half the time of floatval( $x ). Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'