I was wondering what the best way is to get the word before and after a specific keyword from a string?
Example:
$e = "Kuru Kavrulmuş soya Fasulye: 100 gram, ortalamadır";
$_GET['word'] = 'soya';
I would like to then echo out Kavrulmuş
and Fasulye
.
My dynamic snippet is (for getting string)
if ( stripos($e, $_GET['word']) !== false) {
echo '<div class="yellow">'. highlight($e,$_GET['word']) . '</div>';
}
Any ideas?