Req #60630 [Opn->Dup]: I'd like to see two functions added to php: str_begins_with and str_ends_with
| From: | cmb@php.net | Date: | Fri, 15 Sep 2017 17:16:48 +0000 |
| Subject: | Req #60630 [Opn->Dup]: I'd like to see two functions added to php: str_begins_with and str_ends_with | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211180@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60630&edit=1
ID: 60630
Updated by: cmb@php.net
Reported by: regality at gmail dot com
Summary: I'd like to see two functions added to php:
str_begins_with and str_ends_with
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: *General Issues
+Package: Strings related
Operating System: Linux
PHP Version: 5.4.0RC4
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #50434.
Previous Comments:
------------------------------------------------------------------------
[2011-12-31 12:38:46] pajoye@php.net
However if you like to propose them, please write a RFC and a patch. The RFC
process is described here: https://wiki.php.net/rfc/voting
Cheers,
------------------------------------------------------------------------
[2011-12-31 12:15:44] pajoye@php.net
substr allows that very easily, for example with negative offset for the end with
part of your request.
------------------------------------------------------------------------
[2011-12-31 12:08:51] regality at gmail dot com
Description:
------------
I would like to see to string functions added to php. I know they are easy to
implement in userland, but it would be nice to have them in the core.
I coded them up and attached a patch.
The functions are:
str_begins_with(string $haystack, string $needle [, $case_insensitive = false])
and
str_ends_with(string $haystack, string $needle [, $case_insensitive = false])
I think they are pretty self explanatory, check if a string begins with or ends
with another string.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60630&edit=1