#48072 [NEW]: wish: extra strtr features similar to GNU strtr
| From: | php at richardneill dot org | Date: | Fri, 24 Apr 2009 17:17:54 +0000 |
| Subject: | #48072 [NEW]: wish: extra strtr features similar to GNU strtr | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-136210@lists.php.net to get a copy of this message | ||
From: php at richardneill dot org
Operating system: all
PHP version: 6CVS-2009-04-24 (CVS)
PHP Bug Type: Feature/Change Request
Bug description: wish: extra strtr features similar to GNU strtr
Description:
------------
Can we have the extra features added to strtr() that are in the GNU strtr?
They'd be really useful.
In particular, the ability to delete certain characters from the string
[currently we must resort to str_replace, which gets ugly], and to squeeze
repeated characters to a single one [requires preg_replace() at the moment]
This could be done by adding some predefined constants such as
STRTR_DELETE, STRTR_SQUEEZE_REPEATS
Reproduce code:
---------------
In GNU tr, we can do things like
echo "hello world" | tr -s "l"
#results in "helo world" (duplicate 'l' removed)
echo "hello world" | tr -d 'od' ('o' and 'd' removed)
#results in "hell wrl"
echo "hello world" | tr -s "wl" "zl" (translate AND squeeze)
#results in "helo zorld"
(Support for character classes might be nice too)
Thank you.
--
Edit bug report at http://bugs.php.net/?id=48072&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48072&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48072&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48072&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48072&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48072&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48072&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48072&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48072&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48072&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48072&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48072&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48072&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48072&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48072&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48072&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48072&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48072&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48072&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48072&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48072&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48072&r=mysqlcfg