<?php //code here ?>
You can also use:
<script language="php"> //code here </script>
Both of the preceding methods are always available for php scripts to use. You can also optionally use php short tags or ASP-style short tags although both of these methods can be turned on and off using the php directives short_open_tag (on by default) and asp_tags (off by default) respectively:
//short tags
<? //stuff here ?>
<?= $somevar; ?> // will emulate <?php echo $somevar; ?>
//asp tags
<% //stuff here %>
Since short tags are not always available depending upon a server's configuration, they are less portable and therefore it is generally considered best practice to avoid their usage. PHP short tags can also potentially conflict with XML open tags.
No comments:
Post a Comment