Bug #11457:

From: Date: Wed, 13 Jun 2001 05:51:51 +0000
Subject: Bug #11457:
Groups: php.dev 
Request: Send a blank email to php-dev+get-57209@lists.php.net to get a copy of this message
From: adamw@uscho.com 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

« previous php.dev (#57209) next »