Say, $var = "Hello<br>How are <strong>you</strong>";
I want echo $var to display the assigned string Hello<br>How are <strong>you</strong> as it is not the
parsed html code.
How do I do that?
HTML tags will automatically parsed by the browser. To see the pure HTML source anyways, the tags needs to be encoded, especially the angle brackets.
There is a dedicated PHP function available for that called htmlentities().
$var = "Hello<br>How are <strong>you</strong>";
echo htmlentitites($var);
Will encode it in the browser so you can see it displayed as plain text like in $var. The browser will see this:
Hello<br>How are <strong>you</strong>
echo strip_tags($var);.echo htmlentities($var);.