Php in Html
How to Use Php in Html?
Explanation
PHP is the abbreviation for Hypertext Pre Processor, which is a server-side scripting language. PHP is used for web development and as general-purpose programming language. Learn how to use php in html using this simple tutorial.
HTML can be used inside PHP page using "echo" statement.
A PHP script starts with <?php and ends with ?>. PHP script uses a built-in PHP function "echo" to output something on a web page. The example code is given below to show how to use php in html.
HTML PHP:
<?php
echo "<html>";
echo "<head></head>";
echo "<body>";
echo "</body>";
echo "</html>";
?>
The HTML tags are used inside php by using the echo statement.
Example :
<?php
echo "<html>";
echo "<head></head>";
echo "<body>";
echo "<h3>This is a sample example to display html using php</h3>";
echo "</body>";
echo "</html>";
?>
Result :
This is a sample example to display html using php