Will PHP commands work in an html file?

Token Joker

New member
Or do they have to be a .php file to work?

If they have to be in a .php file, can someone explain why a .php can have HTML, but an .html won't accept PHP commands...
 
yes as long as you place the php tags inside of your html

for example:

<html>
<head>
<title>Sample</title>
</head>
<body>
<h1>Test</h1>
<br>

<?php
echo "Hello World!"; // This will print out Hello World!
?>

<br>
</body>
</html>
 
Back
Top