<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.info.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.php-uname.php',
    1 => 'php_uname',
    2 => 'Returns information about the operating system PHP is running on',
  ),
  'up' => 
  array (
    0 => 'ref.info.php',
    1 => 'PHP Options/Info Functions',
  ),
  'prev' => 
  array (
    0 => 'function.php-sapi-name.php',
    1 => 'php_sapi_name',
  ),
  'next' => 
  array (
    0 => 'function.phpcredits.php',
    1 => 'phpcredits',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/info/functions/php-uname.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.php-uname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">php_uname</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.2, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">php_uname</span> &mdash; <span class="dc-title">Returns information about the operating system PHP is running on</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.php-uname-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>php_uname</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$mode</code><span class="initializer"> = &quot;a&quot;</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>php_uname()</strong></span> returns a description of the operating
   system PHP is running on.  This is the same string you see at the very
   top of the <span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span> output.  For the name of just
   the operating system, consider using the <strong><code><a href="reserved.constants.php#constant.php-os">PHP_OS</a></code></strong>
   constant, but keep in mind this constant will contain the operating
   system PHP was <em>built</em> on.
  </p>
  <p class="para">
   On some older UNIX platforms, it may not be able to determine the
   current OS information in which case it will revert to displaying
   the OS PHP was built on.  This will only happen if your uname() 
   library call either doesn&#039;t exist or doesn&#039;t work.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.php-uname-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">mode</code> is a single character that defines what
       information is returned:
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <code class="literal">&#039;a&#039;</code>: This is the default. Returns the same
          information as the individual modes
          <span class="simplelist"><code class="literal">&#039;s&#039;</code>, <code class="literal">&#039;n&#039;</code>, <code class="literal">&#039;r&#039;</code>, <code class="literal">&#039;v&#039;</code>, <code class="literal">&#039;m&#039;</code></span>
          separated by spaces.
         </p>
        </li>
        <li class="listitem">
         <span class="simpara">
          <code class="literal">&#039;s&#039;</code>: Operating system name. eg.
           <code class="literal">FreeBSD</code>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <code class="literal">&#039;n&#039;</code>: Host name. eg. 
          <code class="literal">localhost.example.com</code>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <code class="literal">&#039;r&#039;</code>: Release name. eg. 
          <code class="literal">5.1.2-RELEASE</code>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <code class="literal">&#039;v&#039;</code>: Version information. Varies a lot between
          operating systems.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <code class="literal">&#039;m&#039;</code>: Machine type. eg. <code class="literal">i386</code>.
         </span>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.php-uname-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the description, as a string.
  </p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       Throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> when an invalid
       <code class="parameter">mode</code> is specified.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.php-uname-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Some <span class="function"><strong>php_uname()</strong></span> examples</strong></p>
    <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 </span><span style="color: #0000BB">php_uname</span><span style="color: #007700">();<br />echo </span><span style="color: #0000BB">PHP_OS</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* Some possible outputs:<br />Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686<br />Linux<br /><br />FreeBSD localhost 3.2-RELEASE #15: Mon Dec 17 08:46:02 GMT 2001<br />FreeBSD<br /><br />Windows NT XN1 5.1 build 2600<br />WINNT<br />*/<br /><br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #0000BB">PHP_OS</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">)) === </span><span style="color: #DD0000">'WIN'</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">'This is a server using Windows!'</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">'This is a server not using Windows!'</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   There are also some related <a href="language.constants.predefined.php" class="link">
   Predefined PHP constants</a> that may come in handy, for example:
   <div class="example" id="example-2">
    <p><strong>Example #2 A few OS related constant examples</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// *nix<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">DIRECTORY_SEPARATOR</span><span style="color: #007700">; </span><span style="color: #FF8000">// /<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">PHP_SHLIB_SUFFIX</span><span style="color: #007700">;    </span><span style="color: #FF8000">// so<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">PATH_SEPARATOR</span><span style="color: #007700">;      </span><span style="color: #FF8000">// :<br /><br />// Win*<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">DIRECTORY_SEPARATOR</span><span style="color: #007700">; </span><span style="color: #FF8000">// \<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">PHP_SHLIB_SUFFIX</span><span style="color: #007700">;    </span><span style="color: #FF8000">// dll<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">PATH_SEPARATOR</span><span style="color: #007700">;      </span><span style="color: #FF8000">// ;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.php-uname-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.phpversion.php" class="function" rel="rdfs-seeAlso">phpversion()</a> - Gets the current PHP version</span></li>
    <li><span class="function"><a href="function.php-sapi-name.php" class="function" rel="rdfs-seeAlso">php_sapi_name()</a> - Returns the type of interface between web server and PHP</span></li>
    <li><span class="function"><a href="function.phpinfo.php" class="function" rel="rdfs-seeAlso">phpinfo()</a> - Outputs information about PHP's configuration</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>