Re: Adding a more logical string slicing function to PHP
| From: | Martin Scotta | Date: | Thu, 31 Mar 2011 15:36:48 +0000 |
| Subject: | Re: Adding a more logical string slicing function to PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51768@lists.php.net to get a copy of this message | ||
Martin Scotta
On Thu, Mar 31, 2011 at 12:05 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> 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()?
>
>
They differ in the return type
boolean str_contains(string, string);
string strstr(string, string);
-Rasmus
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>