Bug #15941: feature request for str_replace_first
| From: | tit dot petric at telemach dot net | Date: | Thu, 07 Mar 2002 20:08:25 +0000 |
| Subject: | Bug #15941: feature request for str_replace_first | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-1962@lists.php.net to get a copy of this message | ||
From: tit.petric@telemach.net
Operating system: all
PHP version: 4.1.2
PHP Bug Type: Feature/Change Request
Bug description: feature request for str_replace_first
function str_replace_first($search, $replace, $subject)
{
$retval = $subject;
$pos = strpos($subject,$search);
if ($pos !== false) {
$retval =
substr_replace($subject,$replace,$pos,strlen($search));
}
return $retval;
}
the above function would be useful in the str_functions, would probably be
faster in c.. and i bet some people use something similar atleast once in
their life :D
--
Edit bug report at http://bugs.php.net/?id=15941&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=15941&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15941&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15941&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15941&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15941&r=support
Expected behavior: http://bugs.php.net/fix.php?id=15941&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15941&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=15941&r=submittedtwice