#50434 [NEW]: add string functions str_startswith and str_endswith for convenience
| From: | mail at daniel-faber dot de | Date: | Wed, 09 Dec 2009 23:39:58 +0000 |
| Subject: | #50434 [NEW]: add string functions str_startswith and str_endswith for convenience | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-145601@lists.php.net to get a copy of this message | ||
From: mail at daniel-faber dot de
Operating system:
PHP version: 5.2.11
PHP Bug Type: Feature/Change Request
Bug description: add string functions str_startswith and str_endswith for convenience
Description:
------------
Please add these two string functions for convenience:
boolean str_startswith($string, $prefix)
// true if $string starts with $prefix, false otherwise
boolean str_endswith($string, $suffix)
// true if $string ends with $suffix, false otherwise
Of course one can easily write these functions in PHP, but having them in
the PHP core would be nice. You find them in other languages too:
Java: string.startsWith(prefix) and string.endsWith(suffix)
Python: string.startswith(prefix) and string.endswith(suffix)
--
Edit bug report at http://bugs.php.net/?id=50434&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50434&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50434&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50434&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50434&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50434&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50434&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50434&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50434&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50434&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50434&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50434&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50434&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50434&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50434&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50434&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50434&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50434&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50434&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50434&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50434&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50434&r=mysqlcfg