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:-