How to replace PHP only first and second word and not replace third word ?
I have
$test = "hello i love animal love dog and and love tree";
I want to replace fisrt and secode word love
to underscore
and not replace third word love
like this.
hello i _ animal _ dog and and love tree
Then i use this code
$test = str_replace('love', '_', $test);
echo $test;
But result will be
hello i _ animal _ dog and and _ tree
How can i do for replace only first and second word and not replace third word ?