The code below would have a dot php file extension. In WordPress I have shown the code using a plugin called SyntaxHighlighter Evolved in the second bit of code. It looks a lot better than the first bit of code and uses less space also.
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo ‘<p>Hello World</p>’; ?>
</body>
</html>
<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>