$name
=
"GeeksforGeeks"
;
echo
"
Hello User, < / h1 >
Welcome to {$name} < / p> "
;
?>
Output: Example 2:This example uses PHP print to display the result.
$name
=
"GeeksforGeeks"
;
print
"
Hello User, < / h1 >
Welcome to {$name} < / p> "
;
?>
Output:
Using the echo shortcut or HTML splitting.The PHP echo shortcut can be used to display the result of any expression, the value of any variable, or HTML markup. Example 1:This example uses the shortcut PHP echo to display the result. < tbody>
$name
=
"GeeksforGeeks"
;
?>
Hello User, < / h1 >
{
$name
} welcomes you < / h1 >" ?>
Output: Example 2:separating HTML from PHP
$num = 2;
for
($i = 1; $i < = 10; $i ++) {
? & Gt;
*
= < / p>
}
?>
Output:
Using heredoc.We can use < < <heredoc to print html. < < <must be followed by an identifier and a newline. The same identifier is used to close the body of the heredoc. Syntax:< < < GFG // HTML Markup GFG;
Note:The final identifier must not be indented.Example :
echo
< < < GFG
GeeksforGeeks < / h1 >
I am in heredoc with identifier
’GFG’
. < / p>
GFG;
?>
Output: