Re: [VOTE] Voting opens for str_starts_with and ends_with functions

From: Date: Mon, 08 Jul 2019 10:15:29 +0000
Subject: Re: [VOTE] Voting opens for str_starts_with and ends_with functions
Groups: php.internals 
Request: Send a blank email to internals+get-106162@lists.php.net to get a copy of this message
For those voting against adding these functions, can you clarify why? Do you dislike how they are named, or do you not see the need for the case insensitive versions, or is there an issue with the implementation?
I believe that star_with/end_with is useful, but not in this form. The standard library has 98 string functions with different naming styles. Adding 4 more (8 for mb_) functions for actually two(one?) tasks is redundant. I think that more discussion is needed. My preferred variants: 1) One function
str_contains(
   $haystack,    $needle,    [CASE_INSENSITIVE|FROM_BEGIN|FROM_END|MULTI_BYTE] = 0,    [$encoding] = utf8
)
2)Or two
str_starts_with(...see above, but without FROM_BEGIN|FROM_END)
str_ends_with(...see above, but without FROM_BEGIN|FROM_END)
Best regards,Andrey

« previous php.internals (#106162) next »