Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39131 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68937 invoked from network); 21 Jul 2008 16:26:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2008 16:26:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:51153] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/07-33452-1A8B4884 for ; Mon, 21 Jul 2008 12:26:10 -0400 Received: from [192.168.200.148] (c-24-6-219-206.hsd1.ca.comcast.net [24.6.219.206]) (authenticated bits=0) by mail.lerdorf.com (8.14.3/8.14.3/Debian-5) with ESMTP id m6LGQ2tR004615; Mon, 21 Jul 2008 09:26:02 -0700 Message-ID: <4884B89A.7040508@lerdorf.com> Date: Mon, 21 Jul 2008 09:26:02 -0700 User-Agent: Thunderbird/3.0a2pre (Macintosh; 2008071516) MIME-Version: 1.0 To: Brian Moon CC: Stan Vassilev | FM , internals References: <1216514217.11114.6.camel@localhost> <488295AC.3000107@lerdorf.com> <13F3C3E0FB864C919A2048D507EDB9B9@pc> <48834C31.80806@lerdorf.com> <3025CCBD79414CB2BC9BE1ED3132568C@pc> <4884A18D.7090104@dealnews.com> In-Reply-To: <4884A18D.7090104@dealnews.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mail.lerdorf.com [204.11.219.139]); Mon, 21 Jul 2008 09:26:03 -0700 (PDT) Subject: Re: [PHP-DEV] New string functions: str_startswith() and str_endswith() From: rasmus@lerdorf.com (Rasmus Lerdorf) Brian Moon wrote: > Stan Vassilev | FM wrote: >> I'm particularly for begins/endswith() function as I do this all over my >> code and I'd appreciate the simplification and free extra performance. > > I really don't mean to be rude here, but shorter and less typing !== > performance gain. The PHP string functions are very fast. And if you are > looking to improve your applications performance by using different > string functions, you are likely looking in the wrong place. It also isn't any shorter: if(str_endswith($path,'.php')) vs. if(substr($path,-4)=='.php') And there would be no performance gain since it can be done in a single call now and the code would do pretty much exactly what substr does. -Rasmus