How to write html code in PHP

When developing a web application with PHP, we frequently need to print or echo a few HTML results. This work can be accomplished in a variety of ways. Here are a few examples of methods:

Using “echo or print”:– HTML markup, javascript, text, and variables may all be shown with PHP echo or print.

Example 1: This example uses PHP echo to display the result.

Output:-

Example 2: This example uses PHP print to display the result.

Output :

Using echo shorthand or separating HTML: Any expression, variable value, or HTML markup can be shown with the PHP echo shortcut.

Example 1: This example uses PHP echo shorthand to display the result.

Output:

Example 2: Separating HTML from PHP

Output:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x