Let's see the structure of PHP. How to write the PHP code and its style. As we already know PHP is a scripting language like ASP, JSP. The syntax will be same like the others. Likewise every starting tag must have the corresponding ending tag. While writing the code if you do any mistake with starting and ending tags then PHP interpreter will slaps you by showing different errors with your silly mistakes. So be careful.
Let's see different styles of opening and closing tags.
Style 1:
This is the default and standards compliant starting and ending tags. This type of tags are highly encouraged for writing PHP scripting because now a days every web server is configured in such a way. So must adopt these default style of tags.
Style 2:
These are called short tags.
Style 3:
These are called ASP style tags.
Style 4:
These are called HTML tags.
Style 5:
Do you know PHP code can be embedded in HTML? Let's see how to do this.
There is one more way of embedding PHP script in HTML document. This is the actual style of writing the PHP script in the real world programming. Its highly encouraged style of writing the PHP script. Let's see the code.
I hope you enjoyed the different styles of writing PHP scripting. Thanks for reading this. Any comments and suggestions are accepted.
Let's see different styles of opening and closing tags.
Style 1:
This is the default and standards compliant starting and ending tags. This type of tags are highly encouraged for writing PHP scripting because now a days every web server is configured in such a way. So must adopt these default style of tags.
Style 2:
These are called short tags.
Style 3:
These are called ASP style tags.
Style 4:
These are called HTML tags.
Style 5:
These are called special tags. These special set of tags can be used to output the value of an expression directly to the browser.
Note:
Any code you write that will be between both the starting and ending tags then only the PHP interpreter understands it as a PHP code. Otherwise it will treat it as a normal text and prints as it is. So be wise while choosing the starting and ending tags.
Do you know PHP code can be embedded in HTML? Let's see how to do this.
There is one more way of embedding PHP script in HTML document. This is the actual style of writing the PHP script in the real world programming. Its highly encouraged style of writing the PHP script. Let's see the code.
I hope you enjoyed the different styles of writing PHP scripting. Thanks for reading this. Any comments and suggestions are accepted.
Did You Enjoy this Article ?
If yes, Then enter your email below to get
more such great articles in your inbox
For FREE !






good one...picture is nice..
ReplyDeleteI can see that you have a good understanding about PHP, I refer on this as I started to learn also. Thanks.
ReplyDeleteThanks marvin, keep visiting for more lessons...
Delete