I am currently trying to echo a text value from a variable which contains html-style tags. <...>
$string = "variable_name";
$tag_str = "<".$string.">";
echo $tag_str;
currently this echo's as nothing as it believes it is html code. How would I go about echoing <variable_name>
to the page so it is viewable and not interpreted as code by the browser?
You'll have to html encode your output
$string = "variable_name";
$tag_str = "<".$string.">";
echo htmlspecialchars($tag_str);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With