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

contributors($setup);

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

 </div>

 <div class="refsect1 description" id="refsect1-quickhashintset.exists-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>QuickHashIntSet::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
   set.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashintset.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 set.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashintset.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-quickhashintset.exists-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>QuickHashIntSet::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 set: "</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">$set </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashIntSet</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">$set</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">);<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">$set</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 set: 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); ?>