In the system I am developing I have implemented a function that highlights the searched word (word that is passed in a query) here's the function
function bold_word( $content, $word) {
$replace = '<span class="font-weight-bold">' . $word . '</span>'; // create replacement
$content = str_replace( $word, $replace, $content ); // replace content
return $content; // return highlighted data
}
the problem is that the word being searched for must be identical. if the one entered in the database has a capital letter (such as a surname or a name) the word is not highlighted if the name "Tommy" is entered in the database and the employee searches for tommy, the parlor is not highlighted. how can i solve?