PHP

PHP echo variable with HTML tags2 min read

How to use HTML tags in PHP echo?

Example 1: This example demonstrates that how HTML tags and variable can be used in  PHP echo to display the result.




Output:

Example 2: This example demonstrates that how HTML tags can be used in  PHP echo to display the result by Separating HTML from PHP.

Output:

Example 3: We can use <<< heredoc to print the html. <<< must be followed by an identifier and line break.

Output:

PHP echo variable with HTML tags
PHP echo variable with HTML tags

Leave a Comment