$hello = "I like horse"; $hello{4}="I like cat";
echo $hello; //produce I liIe horse
What should I do so I get
I liI like cate horse?
You could use [man]substr_replace/man.
{4} is position 4 you would have to do a range, and it would replace rather then ad. I would use substr to split the first line,and then jsut reassemble, depending how how dynamic you want hte split to be, that's the key, the assembly is easy
{4} is position 4 you would have to do a range, and it would replace rather then ad.
If you are referring to my suggestion of substr_replace(), I note that one can pass 4 as an argument for where to start the replacement, and that a length of 0 results in an insertion instead of a replacement.