add a character on a string php in specific index code example Example: php insert character into string $newstr = substr_replace($oldstr, $str_to_insert, $pos, 0);