Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 6154

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>Get or set VT100 support for the specified stream associated to an output buffer of a Windows console.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sapi-windows-cp-set.html">sapi_windows_cp_set</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.show-source.html">show_source</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.sapi-windows-vt100-support" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sapi_windows_vt100_support</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0)</p><p class="refpurpose"><span class="refname">sapi_windows_vt100_support</span> &mdash; <span class="dc-title">Get or set VT100 support for the specified stream associated to an output buffer of a Windows console.</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.sapi-windows-vt100-support-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>sapi_windows_vt100_support</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stream</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$enable</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   If <code class="parameter">enable</code> is omitted, the function return <strong><code>TRUE</code></strong> if the stream <code class="parameter">stream</code> has has VT100 control codes enabled, <strong><code>FALSE</code></strong> otherwise.
  </p>
  <p class="para">
   If <code class="parameter">enable</code> is specified, the function will try to enable or disable the VT100 features of the stream <code class="parameter">stream</code>.
   If the feature has been successfully enabled (or disabled), the function will return <strong><code>TRUE</code></strong>, or <strong><code>FALSE</code></strong> otherwise.
  </p>
  <p class="para">
   At startup, PHP tries to enable the VT100 feature of the <strong><code>STDOUT</code></strong>/<strong><code>STDERR</code></strong> streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="simpara">
    The function uses the <strong><code>ENABLE_VIRTUAL_TERMINAL_PROCESSING</code></strong> flag implemented in the Windows 10 API, so the VT100 feature may not be available on older Windows versions.
   </p>
  </div>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.sapi-windows-vt100-support-parameters">
  <h3 class="title">Parameters</h3>
  <dl>

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

    <dd>

     <p class="para">
      The stream on which the function will operate.
     </p>
    </dd>

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

    <dd>

     <p class="para">
      If specified, the VT100 feature will be enabled (if <strong><code>TRUE</code></strong>) or disabled (if <strong><code>FALSE</code></strong>).
     </p>
    </dd>

   
  </dl>

 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.sapi-windows-vt100-support-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If <code class="parameter">enable</code> is not specified: returns <strong><code>TRUE</code></strong> if the VT100 feature is enabled, <strong><code>FALSE</code></strong> otherwise.
  </p>
  <p class="para">
   If <code class="parameter">enable</code> is specified: Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.sapi-windows-vt100-support-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-4674">
   <p><strong>Example #1 <span class="function"><strong>sapi_windows_vt100_support()</strong></span> default state</strong></p>
   <div class="example-contents"><p>
    By default, <strong><code>STDOUT</code></strong> and <strong><code>STDERR</code></strong> have the VT100 feature enabled.
   </p></div>
   <div class="example-contents"><div class="shcode"><pre class="shcode">php -r &quot;var_export(sapi_windows_vt100_support(STDOUT));echo &#039; &#039;;var_export(sapi_windows_vt100_support(STDERR));&quot;</pre>
</div></div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen"><br />
    true true<br />
   </div>
   <div class="example-contents"><p>
    By the way, if a stream is redirected, the VT100 feature will not be enabled:
   </p></div>
   <div class="example-contents"><div class="shcode"><pre class="shcode">php -r &quot;var_export(sapi_windows_vt100_support(STDOUT));echo &#039; &#039;;var_export(sapi_windows_vt100_support(STDERR));&quot; 2&gt;NUL</pre>
</div></div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen"><br />
    true false<br />
   </div>
  </div>
  <div class="example" id="example-4675">
   <p><strong>Example #2 <span class="function"><strong>sapi_windows_vt100_support()</strong></span> changing state</strong></p>
   <div class="example-contents"><p>
    You won&#039;t be able to enable the VT100 feature of <strong><code>STDOUT</code></strong> or <strong><code>STDERR</code></strong> if the stream is redirected.
   </p></div>
   <div class="example-contents"><div class="shcode"><pre class="shcode">php -r &quot;var_export(sapi_windows_vt100_support(STDOUT, true));echo &#039; &#039;;var_export(sapi_windows_vt100_support(STDERR, true));&quot; 2&gt;NUL</pre>
</div></div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen"><br />
    true false<br />
   </div>
  </div>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sapi-windows-cp-set.html">sapi_windows_cp_set</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.show-source.html">show_source</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>