I have the variables $pos, $toRemove and $line. I would like to remove from this string $toRemove from position $pos.
$line = "Hello kitty how are you kitty kitty nice kitty";
$toRemove = "kitty";
$pos = 30; # the 3rd 'kitty'
I want to check if from position 30 there is string kitty and I want to remove exactly this one.
Could you give me a solution of that? I can do it using a lot of loops and variables but it looks strange and works really slow.
1 Answer