Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97474 invoked from network); 31 Mar 2011 15:05:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 15:05:58 -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 74.125.83.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 74.125.83.170 mail-pv0-f170.google.com Received: from [74.125.83.170] ([74.125.83.170:59942] helo=mail-pv0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/D4-04048-458949D4 for ; Thu, 31 Mar 2011 10:05:57 -0500 Received: by pvg16 with SMTP id 16so497680pvg.29 for ; Thu, 31 Mar 2011 08:05:54 -0700 (PDT) Received: by 10.142.136.19 with SMTP id j19mr1995137wfd.167.1301583953806; Thu, 31 Mar 2011 08:05:53 -0700 (PDT) Received: from [192.168.200.140] (c-76-126-236-132.hsd1.ca.comcast.net [76.126.236.132]) by mx.google.com with ESMTPS id s39sm1607926wfc.16.2011.03.31.08.05.50 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Mar 2011 08:05:51 -0700 (PDT) Message-ID: <4D94984D.8060700@lerdorf.com> Date: Thu, 31 Mar 2011 08:05:49 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Philip Olson CC: Martin Jansen , Dan Birken , internals@lists.php.net References: <4D92CC38.5040900@toolpark.com> <004301cbeee8$e54a8280$afdf8780$@com> <4D9387BE.4030808@divbyzero.net> In-Reply-To: X-Enigmail-Version: 1.1.2 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: rasmus@lerdorf.com (Rasmus Lerdorf) On 03/31/2011 07:41 AM, Philip Olson wrote: > > On Mar 30, 2011, at 1:42 PM, Martin Jansen wrote: > >> On 30.03.11 21:36, Dan Birken wrote: >>> As for adding other string functions, I agree, I think there are a lot of >>> them that would be great to add. starts_with & ends_with for sure. >> >> Both str_startswith and str_endswith have been suggested in the past: >> >> http://marc.info/?t=121647230100001&r=1&w=2 >> >> 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()? -Rasmus