I'm using MySQL fulltext search and need to format search result in described below manner.
Is in PHP or some library function, that gets specified parameters and returns specified result?
If no, has anyone an implementation of similar function?
$needles = ['word1', 'word2'];
$haystack = 'This string contains word1. Also this string contains word2';
$wordsGap = 1; //word quantity from left and right of every in $result;
$delimiter = '...';
$result = desired_function($needles, $haystack, $wordsGap, $delimiter);
//$result must be String like '... contains word1. Also ... contains word2'
UPDATES
I need result similar to this one.
http://joxi.net/BA01zg3tJ4l5Or
For now I HAVEN'T desired_function. But I need it. I need a function that gets described parameters and returns described result.