Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39152 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37533 invoked from network); 21 Jul 2008 21:18:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2008 21:18:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 83.243.58.163 as permitted sender) X-PHP-List-Original-Sender: johannes@php.net X-Host-Fingerprint: 83.243.58.163 mail4.netbeat.de Received: from [83.243.58.163] ([83.243.58.163:39228] helo=mail4.netbeat.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/B6-33868-31DF4884 for ; Mon, 21 Jul 2008 17:18:14 -0400 Received: (qmail 22634 invoked by uid 507); 21 Jul 2008 21:18:06 -0000 Received: from ppp-88-217-0-244.dynamic.mnet-online.de (HELO ?192.168.1.101?) (postmaster%schlueters.de@88.217.0.244) by mail4.netbeat.de with ESMTPA; 21 Jul 2008 21:18:06 -0000 To: =?UTF-8?Q?Pawe=C5=82?= Stradomski Cc: internals@lists.php.net In-Reply-To: <200807212206.53954.pstradomski@gmail.com> References: <4884A18D.7090104@dealnews.com> <4884B89A.7040508@lerdorf.com> <200807212206.53954.pstradomski@gmail.com> Content-Type: text/plain; charset=utf-8 Date: Mon, 21 Jul 2008 23:18:07 +0200 Message-ID: <1216675087.3963.15.camel@goldfinger.johannes.nop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] New string functions: str_startswith() and str_endswith() From: johannes@php.net (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Mon, 2008-07-21 at 22:06 +0200, Paweł Stradomski wrote: > W liście Rasmus Lerdorf z dnia poniedziałek, 21 lipca 2008: > > It also isn't any shorter: > > > > if(str_endswith($path,'.php')) > > > > vs. > > > > if(substr($path,-4)=='.php') > > Only if comparing to a static string, but not for this case: > > if (substr($path, -strlen($extension)) == $extension) Then $extension is a CV which isn't that much slower in comparison as a CONST, so from engine-performance-perspective: no big deal -> spend your time optimizing on other places where it has more effect than the time you loose on teaching people about all the fancy string functions (where we already have more than enough) > Readability would also increase. too many functions hurt more on readability imo ... johannes