<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.quickhashintstringhash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'quickhashintstringhash.add.php',
    1 => 'QuickHashIntStringHash::add',
    2 => 'This method adds a new entry to the hash',
  ),
  'up' => 
  array (
    0 => 'class.quickhashintstringhash.php',
    1 => 'QuickHashIntStringHash',
  ),
  'prev' => 
  array (
    0 => 'class.quickhashintstringhash.php',
    1 => 'QuickHashIntStringHash',
  ),
  'next' => 
  array (
    0 => 'quickhashintstringhash.construct.php',
    1 => 'QuickHashIntStringHash::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/quickhash/quickhashintstringhash/add.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="quickhashintstringhash.add" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntStringHash::add</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntStringHash::add</span> &mdash; <span class="dc-title">This method adds a new entry to the hash</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashintstringhash.add-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>QuickHashIntStringHash::add</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   This method adds a new entry to the hash, and returns whether the entry was
   added. Entries are by default always added unless
   <strong><code><a href="class.quickhashintstringhash.php#quickhashintstringhash.constants.check-for-dupes">QuickHashIntStringHash::CHECK_FOR_DUPES</a></code></strong> has been passed when the hash was created.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashintstringhash.add-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <span class="simpara">
      The key of the entry to add.
     </span>
    </dd>
   
   
    <dt><code class="parameter">value</code></dt>
    <dd>
     <span class="simpara">
      The value of the entry to add. If a non-string is passed, it will be
      converted to a string automatically if possible.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashintstringhash.add-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> when the entry was added, and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the entry was not added.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashintstringhash.add-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>QuickHashIntStringHash::add()</strong></span> example</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: #DD0000">"without dupe checking\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">( </span><span style="color: #0000BB">1024 </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #DD0000">"twenty two" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #DD0000">"twelve" </span><span style="color: #007700">) );<br /><br />echo </span><span style="color: #DD0000">"\nwith dupe checking\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">( </span><span style="color: #0000BB">1024</span><span style="color: #007700">, </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">::</span><span style="color: #0000BB">CHECK_FOR_DUPES </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #DD0000">"seventy eight" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #0000BB">4 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #DD0000">"nine" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">without dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
string(10) &quot;twenty two&quot;
bool(true)

with dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
string(13) &quot;seventy eight&quot;
bool(false)</pre>
</div>
   </div>
  </div>
 </div>



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