<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.gettext.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.ngettext.php',
    1 => 'ngettext',
    2 => 'Plural version of gettext',
  ),
  'up' => 
  array (
    0 => 'ref.gettext.php',
    1 => 'Gettext 函数',
  ),
  'prev' => 
  array (
    0 => 'function.gettext.php',
    1 => 'gettext',
  ),
  'next' => 
  array (
    0 => 'function.textdomain.php',
    1 => 'textdomain',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/gettext/functions/ngettext.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ngettext" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ngettext</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ngettext</span> &mdash; <span class="dc-title">Plural version of gettext</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ngettext-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ngettext</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$singular</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$plural</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$count</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   The plural version of <span class="function"><a href="function.gettext.php" class="function">gettext()</a></span>.  Some languages 
   have more than one form for plural messages dependent on the count.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ngettext-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">singular</code></dt>
     <dd>
      <p class="para">
       The singular message ID.
      </p>
     </dd>
    
    
     <dt><code class="parameter">plural</code></dt>
     <dd>
      <p class="para">
       The plural message ID.
      </p>
     </dd>
    
    
     <dt><code class="parameter">count</code></dt>
     <dd>
      <p class="para">
       The number (e.g. item count) to determine the translation for the
       respective grammatical number.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ngettext-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns correct plural form of message identified by 
   <code class="parameter">singular</code> and <code class="parameter">plural</code>
   for count <code class="parameter">count</code>. 
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ngettext-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>ngettext()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />setlocale</span><span style="color: #007700">(</span><span style="color: #0000BB">LC_ALL</span><span style="color: #007700">, </span><span style="color: #DD0000">'cs_CZ'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">ngettext</span><span style="color: #007700">(</span><span style="color: #DD0000">"%d window"</span><span style="color: #007700">, </span><span style="color: #DD0000">"%d windows"</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">), </span><span style="color: #0000BB">1</span><span style="color: #007700">); </span><span style="color: #FF8000">// 1 okno<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">ngettext</span><span style="color: #007700">(</span><span style="color: #DD0000">"%d window"</span><span style="color: #007700">, </span><span style="color: #DD0000">"%d windows"</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">), </span><span style="color: #0000BB">2</span><span style="color: #007700">); </span><span style="color: #FF8000">// 2 okna<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">ngettext</span><span style="color: #007700">(</span><span style="color: #DD0000">"%d window"</span><span style="color: #007700">, </span><span style="color: #DD0000">"%d windows"</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">), </span><span style="color: #0000BB">5</span><span style="color: #007700">); </span><span style="color: #FF8000">// 5 oken<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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

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