php - How can I insert text in an html element stored in a variable? -
I have a program copying text from another website and showing it.
This is accumulating text in a variable For example: To add text before the divi whose ID is 'game' simply use: $ string .
There are variables containing html tags and I want to add text before the html tag stored in the variable. . $ string = "
I want to add code before
div whose ID is
game .
$ string = "& lt; div id = '1' & gt; div id = 'game' & gt; & lt; / div & gt;"; $ New = "TextInstruct"; $ Pos = "& lt; div id = 'game' & gt; & lt; / div & gt;"; Echo str_replace ($ pos, $ new. $ Pos, $ string);
Comments
Post a Comment