All PHP code goes between the php tag. It starts with <?php and ends with ?>.
The default file extension for PHP files is “.php”.
Every PHP statement end with a semicolon (;)
The syntax of PHP tag is given below:
<?php
echo "Hello, world!";
?>
Output:
Hello, world!
Embedding PHP within HTML-
PHP code is embedded within the HTML document using <?php to start the PHP code block and ?> to end it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A Simple PHP File</title>
</head>
<body>
<h1><?php echo "Hello, world!"; ?></h1>
</body>
</html>
Output: