Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 9378

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>PHP tags</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.basic-syntax.html">Basic syntax</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.basic-syntax.phpmode.html">Escaping from HTML</a></div>
 <div class="up"><a href="language.basic-syntax.html">Basic syntax</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="language.basic-syntax.phptags" class="sect1">
   <h2 class="title">PHP tags</h2>
   <p class="para">
    When PHP parses a file, it looks for opening and closing tags, which are
    <em>&lt;?php</em> and <em>?&gt;</em> which tell PHP to
    start and stop interpreting the code between them. Parsing in this manner
    allows PHP to be embedded in all sorts of different documents, as
    everything outside of a pair of opening and closing tags is ignored by the
    PHP parser.
   </p>
   <p class="para">
    PHP also allows for short open tag <em>&lt;?</em> (which is
    discouraged since it is only available if enabled using the
    <a href="ini.core.html#ini.short-open-tag" class="link">short_open_tag</a> <var class="filename">php.ini</var>
    configuration file directive, or if PHP was configured with the
    <strong class="option unknown">--enable-short-tags</strong>
 option).
   </p>
   <p class="para">
    If a file is pure PHP code, it is preferable to omit the PHP closing tag
    at the end of the file.  This prevents accidental whitespace or new lines
    being added after the PHP closing tag, which may cause unwanted effects
    because PHP will start output buffering when there is no intention from
    the programmer to send any output at that point in the script.
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Hello&nbsp;world"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;...&nbsp;more&nbsp;code<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Last&nbsp;statement"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;the&nbsp;script&nbsp;ends&nbsp;here&nbsp;with&nbsp;no&nbsp;PHP&nbsp;closing&nbsp;tag</span>
</span>
</code></div>
     </div>

    </div>
   </p>
   <p class="para">
    <table class="doctable table">
     <caption><strong>Changelog</strong></caption>
     
      <thead>
       <tr>
        <th>Version</th>
        <th>Description</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>7.0.0</td>
         <td>
          The ASP tags <code class="code">&lt;%</code>, <code class="code">%&gt;</code>,
          <code class="code">&lt;%=</code>, and the script tag
          <code class="code">&lt;script language=&quot;php&quot;&gt;</code> are removed from PHP.
         </td>
       </tr>

       <tr>
        <td>5.4.0</td>
         <td>
          The tag &lt;?= is always available regardless of the short_open_tag ini setting.
         </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.basic-syntax.html">Basic syntax</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.basic-syntax.phpmode.html">Escaping from HTML</a></div>
 <div class="up"><a href="language.basic-syntax.html">Basic syntax</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>