Sometimes, we want to echo HTML in PHP.
In this article, we’ll look at how to echo HTML in PHP.
How to echo HTML in PHP?
To echo HTML in PHP, we can put them in a multiline string.
For insrtance, we write
$variable = <<<XYZ
<html>
<body>
</body>
</html>
XYZ;
echo $variable;
to put the HTML tags in the $variable
string.
Then we echo
the $variable
value in the last line.
Conclusion
To echo HTML in PHP, we can put them in a multiline string.