Edit report at https://bugs.php.net/bug.php?id=60630&edit=1

 ID:                 60630
 Updated by:         paj...@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
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   Linux
 PHP Version:        5.4.0RC4
 Block user comment: N
 Private report:     N

 New Comment:

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,


Previous Comments:
------------------------------------------------------------------------
[2011-12-31 12:15:44] paj...@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

Reply via email to