Combine HTML and PHP code on single page explain in brief?

Combine HTML and PHP code on 

single page explain in brief?

PHP in HTML

While creating a complex page, at times you will need to use PHP and HTML to achieve your essential results. 

At first point, this seems complicated, because PHP and HTML are two separate languages, but this is not the case. 

PHP is designed to communicate with HTML and PHP scripts, it can be included in the HTML page without any problems.

Take the following, as an example

<?php echo "The solution to 2 + 2 is "; ?>
<?php echo 2 + 2; ?>
OutPutThe solution to 2 + 2 is 4

There’s really no reason to include two sets of opening and closing tags. You could easily just write
PHP files can contain both static text and executable PHP code. 
Whether or not a specific part of the file is rendered directly as text, or intepreted as PHP code is down to the use of the opening and closing PHP tags. 
Whenever the code is between the <?php and ?> tags, it will be executed as PHP code.
Example
<html>   <head>       <title><?php echo "My Fiest Program";?></title>   </head><body>
<?php echo "<h1>Hello India</h1>"; ?>
</body></html>

Out PutHello India



EmoticonEmoticon