/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* neo_highlight_keywords(string $text, array $keywords, string $tag_start, string $tag_end) use : echo neo_highlight_keywords($text, $keywords, '<span>', '</span>'); $keywords between $tag_start and $tag_end better match with function neo_remove_accent() */ function neo_highlight_keywords($text, $keywords, $tag_start, $tag_end){ $original = $text; foreach($keywords as $keyword){ $current = $offset = $delta = 0; $delta += $tagLen; // Add String Tags Lenght $offset = $pos + 1; } } return $original; }