title: Get sentence(s) which include(s) searched word(s)?
body: <p>I want to get sentence(s) which include(s) searched word(s). I have tried this but can't make it work properly.</p>
  
  <pre><code>$string = "I think instead of trying to find sentences, I'd think about the amount of 
  context around the search term I would need in words. Then go backwards some fraction of this number of words (or to the beginning) and forward the remaining number 
  of words to select the rest of the context.";
  
  $searchlocation = "fraction";
  
  $offset = stripos( strrev(substr($string, $searchlocation)), '. ');
  $startloc = $searchlocation - $offset;
  echo $startloc;
  </code></pre>