Re: Adding a more logical string slicing function to PHP

From: Date: Thu, 31 Mar 2011 15:44:27 +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-51770@lists.php.net to get a copy of this message
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

« previous php.internals (#51770) next »