Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51770 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9191 invoked from network); 31 Mar 2011 15:44:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 15:44:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=martin@divbyzero.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=martin@divbyzero.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain divbyzero.net from 87.230.111.147 cause and error) X-PHP-List-Original-Sender: martin@divbyzero.net X-Host-Fingerprint: 87.230.111.147 mx.bauer-kirch.de Linux 2.6 Received: from [87.230.111.147] ([87.230.111.147:38265] helo=mx.bauer-kirch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/17-04048-161A49D4 for ; Thu, 31 Mar 2011 10:44:33 -0500 Received: by mx.bauer-kirch.de with ESMTP id 1Q5K2u-00070S-Ko; Thu, 31 Mar 2011 17:44:28 +0200 Message-ID: <4D94A15B.1070205@divbyzero.net> Date: Thu, 31 Mar 2011 17:44:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Rasmus Lerdorf CC: Philip Olson , Dan Birken , internals@lists.php.net References: <4D92CC38.5040900@toolpark.com> <004301cbeee8$e54a8280$afdf8780$@com> <4D9387BE.4030808@divbyzero.net> <4D94984D.8060700@lerdorf.com> In-Reply-To: <4D94984D.8060700@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Adding a more logical string slicing function to PHP From: martin@divbyzero.net (Martin Jansen) On 31.03.11 17:05, Rasmus Lerdorf wrote: > On 03/31/2011 07:41 AM, Philip Olson wrote: >> On Mar 30, 2011, at 1:42 PM, Martin Jansen wrote: >>> I recently got around to merge them into a largely unfinished extension >>> so they are archived somewhere safe: https://github.com/mj/php-ext-str >> >> I see str_contains() on the TODO there. I've always wanted in_string() so am glad to see a similar item. Using strpos() for this task feels dirty, much like using arrpos() for arrays would ;) > > How would str_contains() be different from strstr()? I think my main objective was to have a utility function that has the advantages of strpos (i.e. faster and less memory usage than strstr) while having a strict boolean return value so that I don't need to remember to use === all the time. - Martin