Jump to content
Larry Ullman's Book Forums

Php Or Html?


Recommended Posts

On page 8 RE Script 1.2 it says "create a new PHP document to be named phpinfo.php.  Begin the page with <?php."  On page 16 it says "begin a new HTML document to be named hello1.php."  Throughout the book examples start as the latter but are called .php scripts.  Since Script 1.3 has much "hard-coded HTML" it could have been created as a html doc and the interpreter would have processed <?php statements within it anyway.  But if they are PHP scripts wouldn't it be better documentation to start the page with <?php instead of <!doctype html>?

Link to comment
Share on other sites

No, not necessarily. PHP was developed to be HTML-embedded, which means you can put the PHP code within the HTML. This means in some situations it makes sense to start with the HTML and then add the PHP to that. In other situations, such as when a page is only PHP or you're using templates, it makes sense to start with the PHP. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...