Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 3929

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>Syntax highlighting of a string</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.highlight-file.html">highlight_file</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.hrtime.html">hrtime</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-string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">highlight_string</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">highlight_string</span> &mdash; <span class="dc-title">Syntax highlighting of a string</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.highlight-string-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_string</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$str</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$return</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
  ] )</div>

  <p class="simpara">
   Outputs or returns html markup for a syntax highlighted version of the given PHP code
   using the colors defined in the built-in syntax highlighter for PHP.
  </p>
 </div>


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

    
     <dt>
<code class="parameter">str</code></dt>

     <dd>

      <p class="para">
       The PHP code to be highlighted. This should include the opening tag.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">return</code></dt>

     <dd>

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

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.highlight-string-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If <code class="parameter">return</code> 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 examples" id="refsect1-function.highlight-string-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4669">
    <p><strong>Example #1 <span class="function"><strong>highlight_string()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />highlight_string</span><span style="color: #007700">(</span><span style="color: #DD0000">'&lt;?php&nbsp;phpinfo();&nbsp;?&gt;'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;
&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php phpinfo&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(); &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.highlight-string-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">When the <code class="parameter">return</code> 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>
  <p class="para">
   The HTML markup generated is subject to change.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.highlight-string-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.highlight-file.html" class="function" rel="rdfs-seeAlso">highlight_file()</a> - Syntax highlighting of a file</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.highlight-file.html">highlight_file</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.hrtime.html">hrtime</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>