<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.quickhashinthash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'quickhashinthash.exists.php',
    1 => 'QuickHashIntHash::exists',
    2 => 'This method checks whether a key is part of the hash',
  ),
  'up' => 
  array (
    0 => 'class.quickhashinthash.php',
    1 => 'QuickHashIntHash',
  ),
  'prev' => 
  array (
    0 => 'quickhashinthash.delete.php',
    1 => 'QuickHashIntHash::delete',
  ),
  'next' => 
  array (
    0 => 'quickhashinthash.get.php',
    1 => 'QuickHashIntHash::get',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/quickhash/quickhashinthash/exists.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="quickhashinthash.exists" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntHash::exists</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntHash::exists</span> &mdash; <span class="dc-title">This method checks whether a key is part of the hash</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashinthash.exists-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>QuickHashIntHash::exists</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="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   This method checks whether an entry with the provided key exists in the
   hash.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashinthash.exists-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">key</code></dt>
     <dd>
      <p class="para">
       The key of the entry to check for whether it exists in the hash.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashinthash.exists-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> when the entry was found, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> when the entry is not
   found.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashinthash.exists-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-5402">
    <p><strong>示例 #1 <span class="function"><strong>QuickHashIntHash::exists()</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: #FF8000">//generate 200000 elements<br /></span><span style="color: #0000BB">$array </span><span style="color: #007700">= </span><span style="color: #0000BB">range</span><span style="color: #007700">( </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">199999 </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$existingEntries </span><span style="color: #007700">= </span><span style="color: #0000BB">array_rand</span><span style="color: #007700">( </span><span style="color: #0000BB">array_flip</span><span style="color: #007700">( </span><span style="color: #0000BB">$array </span><span style="color: #007700">), </span><span style="color: #0000BB">180000 </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$testForEntries </span><span style="color: #007700">= </span><span style="color: #0000BB">array_rand</span><span style="color: #007700">( </span><span style="color: #0000BB">array_flip</span><span style="color: #007700">( </span><span style="color: #0000BB">$array </span><span style="color: #007700">), </span><span style="color: #0000BB">1000 </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$foundCount </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #DD0000">"Creating hash: "</span><span style="color: #007700">, </span><span style="color: #0000BB">microtime</span><span style="color: #007700">( </span><span style="color: #0000BB">true </span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashIntHash</span><span style="color: #007700">( </span><span style="color: #0000BB">100000 </span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Adding elements: "</span><span style="color: #007700">, </span><span style="color: #0000BB">microtime</span><span style="color: #007700">( </span><span style="color: #0000BB">true </span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />foreach( </span><span style="color: #0000BB">$existingEntries </span><span style="color: #007700">as </span><span style="color: #0000BB">$key </span><span style="color: #007700">)<br />{<br />     </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">$key</span><span style="color: #007700">, </span><span style="color: #0000BB">56 </span><span style="color: #007700">);<br />}<br /><br />echo </span><span style="color: #DD0000">"Doing 1000 tests: "</span><span style="color: #007700">, </span><span style="color: #0000BB">microtime</span><span style="color: #007700">( </span><span style="color: #0000BB">true </span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />foreach( </span><span style="color: #0000BB">$testForEntries </span><span style="color: #007700">as </span><span style="color: #0000BB">$key </span><span style="color: #007700">)<br />{<br />     </span><span style="color: #0000BB">$foundCount </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">$key </span><span style="color: #007700">);<br />}<br />echo </span><span style="color: #DD0000">"Done, </span><span style="color: #0000BB">$foundCount</span><span style="color: #DD0000"> found: "</span><span style="color: #007700">, </span><span style="color: #0000BB">microtime</span><span style="color: #007700">( </span><span style="color: #0000BB">true </span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</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">Creating hash: 1263588703.0748
Adding elements: 1263588703.0757
Doing 1000 tests: 1263588703.7851
Done, 898 found: 1263588703.7897</pre>
</div>
    </div>
   </div>
  </p>
 </div>



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