Do I need a !DOCTYPE declaration in a php file with html?

Yes you need a DOCTYPE as your browser only sees the following part of the above code

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>Page Title</title>
    <link rel="stylesheet" href="css/style.css" />
</head>
<body>
Welcome THE USER NAME
</body>
</html>

I usually place the close PHP tag and the DOCTYPE together like so ?><!DOCTYPE HTML>

Leave a Comment