From:             dave at netready dot biz
Operating system: Linux
PHP version:      4.3.1
PHP Bug Type:     Feature/Change Request
Bug description:  new function "str_replace_once"

Hi, 

I have been using str_replace to search and replace over large strings. 
Replacing strings I know for certain only occur once.  I was just thinking
that maybe if there was a str_replace_once function that would stop
searching after it had replaced one instance of search string this could
save considerable time checking the rest of the string.

To make it really useful it could have a backward/forward option so If you
knew the string you are searching for occurs near the end of your string
you could search backwards for it.  Or would that be a separate function?
I'm not sure what your guidlines are on that.

This would have even more speed impact on str_ireplace because by it's
nature it is slower, so maybe a str_ireplace_once would be a good idea
too?
-- 
Edit bug report at http://bugs.php.net/?id=24113&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24113&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24113&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24113&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24113&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24113&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24113&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24113&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24113&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24113&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24113&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24113&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24113&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24113&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24113&r=gnused

Reply via email to