I am trying to display search results in a short, user-friendly way.
Is there an way to strip out the words before and after a particular word?
Using these variables:
$txt = "This is a string with a cool word in it";
$key = "cool";
$limit = 2;
I just want $shortTxt to be like this:
$shortTxt = "with a cool word in";
Does a function exist that can do this?