I don't know if this function is multibyte safe but I've written a function that will do the same in multibyte mode.
<?php
if (!function_exists("mb_substr_replace")){
function mb_substr_replace($string,$replacement,$start,$length=null,$encoding = null){
if ($encoding == null){
if ($length == null){
return mb_substr($string,0,$start).$replacement;
}
else{
return mb_substr($string,0,$start).$replacement.mb_substr($string,$start + $length);
}
}
else{
if ($length == null){
return mb_substr($string,0,$start,$encoding).$replacement;
}
else{
return mb_substr($string,0,$start,$encoding). $replacement. mb_substr($string,$start + $length,mb_strlen($string,$encoding),$encoding);
}
}
}
}
?>