4 different methods for invoking php processing within HTML code dynamically:
- <?php echo("This is the standard way to serve XHTML or XML documents.");
?>
- <? echo "This is the simplest way to serve simplified SGML documents,
but is not universal.";
?>
<?= "My variable is: $my_variable" ?>This is a shortcut for the
echo statement to print out the value of my internal variable $my_variable ?>
- <script language="php"> echo ("This is another standard
long form to invoke php processing, except if you use MS FrontPage!");</script>
- <% echo ("This uses ASP-style tag to invoke php processing, but
it is not standard.");
%>
<%= "Print something out"; # This comments that the code to your
left is a shortcut for the echo statement. %>
Note your file must have .php as extension to cause the operating system
(OS) to parse your file. Otherwise, the OS will send the entire page
back to client as is, without processing it.