54Part IPHP: The BasicsEverything within (Email web hosting) these tags is
54Part IPHP: The BasicsEverything within these tags is understood by the PHP parser to be PHP code. Everythingoutside of these tags does not concern the server and will simply be passed along and left forthe client to sort out whether it s HTML or JavaScript or something else. There are four styles of PHP tags and different rationales for using them. Part of the decision, however, is simply individual preference: what the individual programmer is comfortable withor what a team has decided upon for reasons of their own. Canonical PHP tagsThe most universally effective PHP tag style is: If you use this style, you can be positive that your tags will always be correctly interpreted. Unless you have a very, very strong reason to prefer one of the other styles, use this one. Some or all of the other styles of PHP tag may be phased out in the future only this one iscertain to be safe. Short-open (SGML-style) tagsShort or short-open tags look like this: ?> Short tags are, as one might expect, the shortest option. Those who escape into and out ofHTML frequently in each script will be attracted by the prospect of fewer keystrokes; how- ever, the price of shorter tags is pretty high. You must do one of two things to enable PHPtorecognize the tags: .Choose the –enable-short-tagsconfiguration option when you re building PHP. .Set the short_open_tagsetting in your php.inifile to on. This option must be disabled to parse XML with PHP because the same syntax is used for XML tags. There used to be a third way to enable short-open tags: the short_open()function. Thisceased to be supported as of PHP4. There are several reasons to resist the temptation of the short-open tag. The most compellingreason now is that this syntax is not compatible with XML and since XHTML is a type ofXML, this implies that none of your code will be able to validate as XHTML. PHP code writtenwith short-open tags is less portable because you can t be sure another machine will haveenabled them. Short-open tags are also harder to pick out visually on the page, and many syn- tax-highlighting schemes don t support them. Beginners should be encouraged to start offwith the canonical style tag if at all possible. The short-open tag was one of many hacky ease-of-use ideas that ended up biting the PHPcommunity years later. The PHP development team must now struggle to balance desires fora more standard and consistent syntax with a large installed userbase, which has written ahuge pile of code in the old style. As XML becomes more and more central to Web develop- ment, and as we move toward XHTML as the standard for Web page development, the short- open tag faces a shaky future. Do yourself a favor and start moving toward the canonical PHPtags now. Caution06
Note: In case you are looking for affordable webhost to host and run your web application check Vision cheap hosting services