Learn PHP:5-Where to Place PHP Code Blocks

Posted: September 29, 2010 in PHP
Tags:

PHP blocks(tags) can go anywhere you like in a .php web page document. Anywhere. Many PHP developers choose to make one large PHP block above their <!DOCTYPE> and <html> tags. In this block they would handle all of the information gathering, parsing, or whatever needs to be scripted. They then make variables out of information to echo or print the values out to the browser.

Alternately you can choose to have many PHP blocks exactly located in the HTML <head> or <body> section of the document where that certain data would display.

Both of these scripts below are the same in functionality, and will render the exact same output.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s