How to search for a word in a text

2

I have a string that comes from a database which I read with fetch_array() . Example:

$row=$query->fetch_array();

What I would like is to understand words. For example, if in that string there is the word "CARRO", put that word in bold, that is, enclose said word in an HTML tag either <b> or <a> . Does anyone know how I could do what I need?

    
asked by andy gibbs 25.12.2018 в 23:00
source

1 answer

3

If I understand well, you want the string that returns the database, search for a word and frame it with html tags. See if it helps:

str_replace("CARRO","<b>CARRO</b>",string);
    
answered by 26.12.2018 / 00:06
source