<?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.loadfromstring.php',
    1 => 'QuickHashIntStringHash::loadFromString',
    2 => 'This factory method creates a hash from a string',
  ),
  'up' => 
  array (
    0 => 'class.quickhashintstringhash.php',
    1 => 'QuickHashIntStringHash',
  ),
  'prev' => 
  array (
    0 => 'quickhashintstringhash.loadfromfile.php',
    1 => 'QuickHashIntStringHash::loadFromFile',
  ),
  'next' => 
  array (
    0 => 'quickhashintstringhash.savetofile.php',
    1 => 'QuickHashIntStringHash::saveToFile',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/quickhash/quickhashintstringhash/loadfromstring.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="quickhashintstringhash.loadfromstring" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntStringHash::loadFromString</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntStringHash::loadFromString</span> &mdash; <span class="dc-title">This factory method creates a hash from a string</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashintstringhash.loadfromstring-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>QuickHashIntStringHash::loadFromString</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$contents</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code><span class="initializer"> = 0</span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="class.quickhashintstringhash.php" class="type QuickHashIntStringHash">QuickHashIntStringHash</a></span></div>

  <p class="simpara">
   This factory method creates a new hash from a definition in a string. The
   format is the same as the one used in &quot;loadFromFile&quot;.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashintstringhash.loadfromstring-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">contents</code></dt>
    <dd>
     <span class="simpara">
      The string containing a serialized format of the hash.
     </span>
    </dd>
   
   
    <dt><code class="parameter">size</code></dt>
    <dd>
     <span class="simpara">
      The amount of bucket lists to configure. The number you pass in will be
      automatically rounded up to the next power of two. It is also
      automatically limited from 4 to 4194304.
     </span>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <span class="simpara">
      The same options that the class&#039; constructor takes; except that the size
      option is ignored. It is automatically calculated to be the same as the
      number of entries in the hash, rounded up to the nearest power of two
      with a maximum limit of 4194304.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashintstringhash.loadfromstring-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   Returns a new QuickHashIntStringHash.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashintstringhash.loadfromstring-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>QuickHashIntStringHash::loadFromString()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$contents </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">( </span><span style="color: #0000BB">dirname</span><span style="color: #007700">( </span><span style="color: #0000BB">__FILE__ </span><span style="color: #007700">) . </span><span style="color: #DD0000">"/simple.hash" </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">::</span><span style="color: #0000BB">loadFromString</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$contents</span><span style="color: #007700">,<br />    </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">::</span><span style="color: #0000BB">DO_NOT_USE_ZEND_ALLOC<br /></span><span style="color: #007700">);<br />foreach( </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">0x0f </span><span style="color: #007700">) as </span><span style="color: #0000BB">$key </span><span style="color: #007700">)<br />{<br />    </span><span style="color: #0000BB">printf</span><span style="color: #007700">( </span><span style="color: #DD0000">"Key %3d (%2x) is %s\n"</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">$key</span><span style="color: #007700">, </span><span style="color: #0000BB">$key</span><span style="color: #007700">,<br />        </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">) ? </span><span style="color: #DD0000">'set' </span><span style="color: #007700">: </span><span style="color: #DD0000">'unset'<br />    </span><span style="color: #007700">);<br />}<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">Key   0 ( 0) is unset
Key   1 ( 1) is set
Key   2 ( 2) is set
Key   3 ( 3) is set
Key   4 ( 4) is unset
Key   5 ( 5) is set
Key   6 ( 6) is unset
Key   7 ( 7) is set
Key   8 ( 8) is unset
Key   9 ( 9) is unset
Key  10 ( a) is unset
Key  11 ( b) is set
Key  12 ( c) is unset
Key  13 ( d) is set
Key  14 ( e) is unset
Key  15 ( f) is unset</pre>
</div>
   </div>
  </div>
 </div>



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