To be honest, I'm not sure what you're asking.
Sorry.
Okay, I know that you can put PHP inside of HTML.
I am wondering if you can completely wrap HTML inside of you PHP?
It just seems weird to me to have a ".php" file and yet it is PHP inside of HTML.
I dunno.
Am I making any more sense?
I see what you're saying, but you're looking at it the wrong way. .php files are, well, PHP files. This means they run on the server. The PHP tags denote where you want to execute logic. Code not within those tags is being output to the screen by, essentially, an invisible
echo() call. So, something like:
<!doctype html>
<html lang="en-us">
<head>
<title>Example 3</title>
</head>
<body>
<?php
for($i = 0; $i < 10; ++$i)
{
echo $i . "<br />";
}
?>
</body>
</html>Is actually like:
echo '<!doctype html>\n<html lang="en-us">\n\t<head>\n\t\t<title>\n\t\t\tExample 3\n\t\t</title>\n\t</head>\n\n\t<body>';
for($i = 0; $i < 10; ++$i)
{
echo '\n\t\t$i<br />';
}
echo '\n\t</body>\n\n</html>';Behind the scenes.
The PHP tags tell the PHP interpreter where you want to break from the default, invisible echo and perform logic. This means that wrapping HTML in PHP tags wouldn't work, as the interpreter treats anything within the tags as language constructs. You'd get a ton of errors even trying it.
Also, just because PHP has tags, that doesn't mean that it has anything to do with HTML's Document Object Model (DOM). These tags aren't elements. If you view the rendered source code of a PHP file (like, say, this very forum... right-click, then left-click 'View Source'), you wouldn't see any PHP at all.