|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-25 16:01 UTC] black@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 12:00:01 2025 UTC |
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