Abscissa Tech Home Design Coding Media Server
Tutorials Courses Forums Resources
  Home
 
  Member Options
    Sign Up
  Log In
 
  Tools
    PowerHTML
    Teacher's Lounge
  References
  HTML
  PHP
  CSS
 
  Search
 
 
    Legalese
    Contact Us
    Privacy Policy
    About Abscissa

Chapter 5. Basic syntax

Escaping from HTML

There are four ways of escaping from HTML and entering "PHP code mode":

Example 5-1. Ways of escaping from HTML

  1 
  2 1.  <? echo ("this is the simplest, an SGML processing instruction\n"); ?>
  3  
  4 2.  <?php echo("if you want to serve XML documents, do like this\n"); ?>
  5 
  6 3.  <script language="php"> 
  7         echo ("some editors (like FrontPage) don't
  8               like processing instructions");
  9     </script>
 10 
 11 4.  <% echo ("You may optionally use ASP-style tags"); %>
 12     <%= $variable; # This is a shortcut for "<%echo .." %>
 13       

The first way is only available if short tags have been enabled. This can be done via the short_tags() function, by enabling the short_open_tag configuration setting in the PHP config file, or by compiling PHP with the --enable-short-tags option to configure.

The fourth way is only available if ASP-style tags have been enabled using the asp_tags configuration setting.

Note: Support for ASP-style tags was added in 3.0.4.

The closing tag for the block will include the immediately trailing newline if one is present.

This PHP manual is Copyright © 1997, 1998, 1999, 2000 the PHP Documentation Group. It has been licensed under the GPL. Permission granted for display on the Abscissa Tech web site on March 9, 2000. The most recent PHP documentation is available at http://www.php.net/.