In PHP, how can you replace the second and third character of a string with an X so string would become sXXing?
X
string
sXXing
The string\'s
For replacing, use function
$str = 'bar'; $str[1] = 'A'; echo $str; // prints bAr
or you could use the library function substr_replace as:
$str = substr_replace($str,$char,$pos,1);
similarly for 3rd position