win -:|:- koi -:|:- iso -:|:- dos -:|:- mac

Start -:|:- Проекты -:|:- О нас

Chapter 5. Basic syntax

Table of Contents
Escaping from HTML
Instruction separation

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.  <? echo ("this is the simplest, an SGML processing instruction\n"); ?>
2.  <?php echo("if you want to serve XML documents, do like this\n"); ?>

3.  <script language="php"> 
        echo ("some editors (like FrontPage) don't
              like processing instructions");

4.  <% echo ("You may optionally use ASP-style tags"); %>
    <%= $variable; # This is a shortcut for "<%echo .." %>

The first way is only available if short tags have been enabled (either by calling short_tags(), they are configured on using the short_tags run-time configuration setting, or they are enabled using the --enable-short-tags compile-time configuration setting.

The fourth way is only available if ASP-style tags have been enabled using either the asp_tags configuration setting or the --enable-asp-tags compile-time configuration setting.

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

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


Rambler's Top100 Service Яндекс цитирования