I need to insert a span tag between a certain text from a string, but it should be case insensitive and keep the original case.
$string ="This is what this is";
echo str_replace("this is","[span]this is[/span]",$string);
Returns:
This is what [span]this is[/span]
Expected:
[/span]This is[/span] what [span]this is[/span]
I know the str_replace
is not the good option for that, and ir might be probably handled by Regex, but I have no idea in which direction I should go. Thanks in advance for your help!