How to output HTML from PHP?

Hello!

Can you please tell me how to output any HTML code from a PHP script? Simply, if you output with the usual echo command, then only characters that will not be translated into HTML will be displayed.


Answer 1, authority 100%

I didn’t quite understand the question. If you want to output html from php, then echo will output everything fine.

echo '<a href="#">link</a>';

will display the link. If you need to output special characters, pass the text through htmlspecialchars():

echo htmlspecialchars('<a href="#">link</a>');

will output <a href="#">link</a>.