[PHP-DEV] Bug #11457: From: adamw <email protected>
Date: 06/13/01

From: adamw <email protected>
Operating system:
PHP version: 4.0.5
PHP Bug Type: Feature/Change Request
Bug description:

I've been racking my brain attempting to figure out a way to replace only the first instance of a specified string within a larger string.

Obviously - str_replace does this ... but it does it for *all* instances. Other functions will *find* the first instance, but won't act upon it.

I noticed, however, that "preg_replace" has a fourth parameter ... the "limit" parameter.

How nice would this be for "str_replace" to have that 4th parameter?! It would avoid the need to use a regular expression function.

I am open to workarounds and alternatives. Thank you for the consideration.

-- 
Edit Bug report at: http://bugs.php.net/?id=11457&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>