New String Function: str_replace_limit

From: Date: Sun, 15 Jul 2012 19:45:16 +0000
Subject: New String Function: str_replace_limit
Groups: php.internals 
Request: Send a blank email to internals+get-61253@lists.php.net to get a copy of this message
Hey, I'm proposing to add a new function str_replace_limit, this will be identical to str_replace() with one key difference, you can specify how many times you want the replace to occur. Currently this isn't possible with any functions in the /ext/standard/string.c stack, the only easy workaround is using preg_replace() which requires of course the pcre library and regex patterns. I would have added this as a 4th param to str_replace(), but it already has a 4th by-ref param to tell you how many times it done the replacement. mixed str_replace_limit ( mixed $search , mixed $replace , mixed $subject [, int $limit ] ) Thoughts? Paul Dragoonis.

« previous php.internals (#61253) next »