I'm trying to something really easy but I'm confused...
I'm getting a string in php (from a database) that looks like this when Inspect the element with chrome (also in the database, the string is like this) :
$text=
<p><strong>Title</strong></p>
<p>text1</p>
<p>text2</p>
<p>text3</p>
<p>text4</p>
<p><strong>Title2</strong></p>
.....
I would like to change all the <p>
to <p class ="newclass">
and show the text in the browser in the right way.
I tried different ways like this one:
$newtext = preg_replace('/\b<p>\b/u', '<p class = "newclass">', highlight_string($text, true));
echo $newtext;
but that doesn't works. I tried more example but all of theme didn't works.
So, basically I'm getting some text from a database, and I need to change all <p>
to a specific new class and echo again in the right way.
Thank you very much