This wiki is for the exclusive use of my friends and colleagues. Account creation and anonymous editing have been turned off.

If you are a friend or colleague of mine, and would like to participate in this project, please send me a message.

If you find these pages useful, please donate to help cover server costs. Thanks!

Difference between revisions of "PHP start and end tags"

From OdleWiki
(Created page with "When using PHP, you must tell the PHP engine that it has to parse the PHP. To do so, enclose your PHP code in PHP start and end tags. There are four types of tags available:...")
 
Line 20: Line 20:
 
Only standard and script tags are guaranteed to work on any PHP configuration. Short tags and ASP tags must be explicitly enabled in [[php.ini]].
 
Only standard and script tags are guaranteed to work on any PHP configuration. Short tags and ASP tags must be explicitly enabled in [[php.ini]].
  
To enable short tags, ensure that the <span class="mono">short_open_tag</span> switch is set to on to  
+
To enable short tags, ensure that the <span class="mono">short_open_tag</span> switch in php.ini is set to on to "On":
 +
 
 +
<code>
 +
short_open_tag = On;
 +
</code>
 +
 
 +
To enable ASP-style tags, ensure that the <span class="mono">asp_tags</span> is enabled in php.ini:
 +
 
 +
<code>
 +
asp_tags = On;
 +
</code>
 +
 
 
[[Category:PHP]]
 
[[Category:PHP]]

Revision as of 23:09, 10 December 2013

When using PHP, you must tell the PHP engine that it has to parse the PHP. To do so, enclose your PHP code in PHP start and end tags.

There are four types of tags available: standard tags short tags, ASP tags, and script tags.

Tag Style Start Tag End Tag
Standard tags <?php ?>
Short tags <? ?>
ASP tags <% %>
Script tags <script language="php"> </script>

Only standard and script tags are guaranteed to work on any PHP configuration. Short tags and ASP tags must be explicitly enabled in php.ini.

To enable short tags, ensure that the short_open_tag switch in php.ini is set to on to "On":

short_open_tag = On;

To enable ASP-style tags, ensure that the asp_tags is enabled in php.ini:

asp_tags = On;