highlight search text in php

Solutions on MaxInterview for highlight search text in php by the best coders in the world

showing results for - "highlight search text in php"
Anna
30 Feb 2020
1function highlightWords($text, $word){
2    $text = preg_replace('#'. preg_quote($word) .'#i', '<span style="background-color: #F9F902;">\\0</span>', $text);
3    return $text;
4}
5
6//function calling
7highlightWords($desc, $search_word);