I'm trying to replace 'he' by 'she' between two given positions, in this case between Maria(0) and Peter(34). So basically I give two positions and replace all the occurrences in the sentence between the boundaries. I have tried with the following simple code but it seems that the substr_replace function doesn't allow me to do it. Any idea to make it works?
$sentence = "Maria went to London where he met Peter with his family.";
$clean = substr_replace($sentence, "he", "she", 0, 34);