0 votes

Print variable in html

I would like to print a variable inside a html, the problem is that this html comes from the database, therefore this inside of a string, is there any way to get php to detect that there are variables inside of that string that is brought from the DB?

Anything is of help, many thanks.


sioesi Points 9832

You can use the function str_replace, if within the HTML comes the variable $nombre, you can do the following:

str_replace("$nombre", "nuevo valor", $tu_html);


HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by: