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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...