Is there a function in PHP that takes in a string, a number (i), and a character (x), then replaces the character at position (i) with
i
x
$str = 'bar'; $str[1] = 'A'; echo $str; // prints bAr
or you could use the library function substr_replace as:
substr_replace
$str = substr_replace($str,$char,$pos,1);