Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 3383

php-manual-en-5.5.7-1.mga4.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>Syntax highlighting of a file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.halt-compiler.html">__halt_compiler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.highlight-string.html">highlight_string</a></div>
 <div class="up"><a href="ref.misc.html">Misc. Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.highlight-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">highlight_file</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">highlight_file</span> &mdash; <span class="dc-title">Syntax highlighting of a file</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.highlight-file-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>highlight_file</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$return</code><span class="initializer"> = false</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Prints out or returns a syntax highlighted version of the code contained
   in <em><code class="parameter">filename</code></em> using the colors defined in the
   built-in syntax highlighter for PHP.
  </p>
  <p class="para">
   Many servers are configured to automatically highlight files
   with a <em class="emphasis">phps</em> extension. For example,
   <var class="filename">example.phps</var> when viewed will show the
   syntax highlighted source of the file. To enable this, add this
   line to the <var class="filename">httpd.conf</var>:
  </p>
  <div class="example-contents screen">
<div class="descriptioncode"><pre class="descriptioncode">AddType application/x-httpd-php-source .phps</pre>
</div>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.highlight-file-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">filename</code></em></span>
     <dd>

      <p class="para">
       Path to the PHP file to be highlighted.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">return</code></em></span>
     <dd>

      <p class="para">
       Set this parameter to <strong><code>TRUE</code></strong> to make this function return the
       highlighted code.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.highlight-file-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If <em><code class="parameter">return</code></em> is set to <strong><code>TRUE</code></strong>, returns the highlighted
   code as a string instead of printing it out. Otherwise, it will return
   <strong><code>TRUE</code></strong> on success, <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.highlight-file-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.2.1</td>
       <td>
        This function is now also affected by <a href="ini.sect.safe-mode.html#ini.safe-mode" class="link">safe_mode</a> and <a href="ini.core.html#ini.open-basedir" class="link">open_basedir</a>.
       </td>
      </tr>

      <tr>
       <td>4.2.0</td>
       <td>
        The <em><code class="parameter">return</code></em> parameter was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.highlight-file-notes">
  <h3 class="title">Notes</h3>
  <div class="caution"><strong class="caution">Caution</strong>
   <p class="para">
    Care should be taken when using the  <span class="function"><strong>highlight_file()</strong></span>
    function to make sure that you do not inadvertently reveal sensitive
    information such as passwords or any other type of information that might
    create a potential security risk.
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">When the <em><code class="parameter">return</code></em> parameter
is used, this function uses internal output buffering so it cannot be used inside an
 <span class="function"><a href="function.ob-start.html" class="function">ob_start()</a></span> callback function.</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.highlight-file-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.highlight-string.html" class="function" rel="rdfs-seeAlso">highlight_string()</a> - Syntax highlighting of a string</span></li>
    <li class="member"><a href="misc.configuration.html#ini.syntax-highlighting" class="link">Highlighting INI directives</a></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.halt-compiler.html">__halt_compiler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.highlight-string.html">highlight_string</a></div>
 <div class="up"><a href="ref.misc.html">Misc. Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>