i have a search script that displays results in a table.
i do not wish to use the whole of the resulting text, and would like to trim it to 200 chars or so, 100 either side of the search term.
i have come up with the following as a somewhat crude solution;
$chars = split($search_term, $search_result, 2);
$chars[0] = strrev($chars[0]);
$chars[0] = str_split($chars[0] , 100);
$intro = '.....'.strrev($chars[0][0]);
$chars[1] = str_split($chars[1] , 100);
$outro = $chars[1][0].'.....';
echo $chars[0].$search_term.$chars[1];
i'm hoping someone can provide me with a better way, as i'm not too pleased with it!!
at least i tried!
ollie