
|
|
|||
Chapter 10. Basic syntax
Escaping from HTMLWhen PHP parses a file, it looks for opening and closing tags, which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows php to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser. Most of the time you will see php embedded in HTML documents, as in this example.
You can also use more advanced structures: There are four different pairs of opening and closing tags which can be used in php. Two of those, <?php ?> and <script language="php"> </script>, are always available. The other two are short tags and ASP style tags, and can be turned on and off from the php.ini configuration file. As such, while some people find short tags and ASP style tags convenient, they are less portable, and generally not recommended.
While the tags seen in examples one and two are both always available, example one is the most commonly used, and recommended, of the two.
Short tags (example three) are only available when they are
enabled via the short_open_tag
php.ini configuration file directive, or if php was configured
with the
ASP style tags (example four) are only available when they are enabled via the asp_tags php.ini configuration file directive.
|
||||
| About the NetVisits, Inc Network | Advertise Developer Tutorials hosted by HostGator. Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |