Bug #15941 Updated: feature request for str_replace_first

From: Date: Thu, 25 Jul 2002 20:01:52 +0000
Subject: Bug #15941 Updated: feature request for str_replace_first
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15239@lists.php.net to get a copy of this message
ID: 15941 Updated by: black@php.net Reported By: tit.petric@telemach.net -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: all PHP Version: 4.1.2 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2002-03-07 15:08:24] tit.petric@telemach.net 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 this bug report at http://bugs.php.net/?id=15941&edit=1

« previous php.bugs (#15239) next »