$newstr = substr_replace($oldstr, $str_to_insert, $pos, 0);
http://php.net/substr_replace
In the above snippet, $pos is used in the offset argument of the function.
offset
If offset is non-negative, the replacing will begin at the
offset’th offset into string.If offset is negative, the replacing will begin at the offset’th
character from the end of string.