Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10429

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>This factory method creates a set from a file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="quickhashintset.getsize.html">QuickHashIntSet::getSize</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="quickhashintset.loadfromstring.html">QuickHashIntSet::loadFromString</a></div>
 <div class="up"><a href="class.quickhashintset.html">QuickHashIntSet</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="quickhashintset.loadfromfile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntSet::loadFromFile</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntSet::loadFromFile</span> &mdash; <span class="dc-title">This factory method creates a set from a file</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashintset.loadfromfile-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="type"><a href="class.quickhashintset.html" class="type QuickHashIntSet">QuickHashIntSet</a></span> <span class="methodname"><strong>QuickHashIntSet::loadFromFile</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   This factory method creates a new set from a definition file on disk. The
   file format consists of 32 bit signed integers packed together in the
   Endianness that the system that the code runs on uses.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashintset.loadfromfile-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">filename</code></em></span>
     <dd>

      <p class="para">
       The filename of the file to read the set from.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">size</code></em></span>
     <dd>

      <p class="para">
       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.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">options</code></em></span>
     <dd>

      <p class="para">
       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 set, rounded up to the nearest power of two
       with a maximum limit of 4194304.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashintset.loadfromfile-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a new QuickHashIntSet.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashintset.loadfromfile-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-5134">
    <p><strong>Example #1  <span class="function"><strong>QuickHashIntSet::loadFromFile()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">__FILE__&nbsp;</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"/simple.set"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$set&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">QuickHashIntSet</span><span style="color: #007700">::</span><span style="color: #0000BB">loadFromFile</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$file</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">QuickHashIntSet</span><span style="color: #007700">::</span><span style="color: #0000BB">DO_NOT_USE_ZEND_ALLOC<br /></span><span style="color: #007700">);<br />foreach(&nbsp;</span><span style="color: #0000BB">range</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x0f&nbsp;</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"Key&nbsp;%3d&nbsp;(%2x)&nbsp;is&nbsp;%s\n"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$set</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #DD0000">'set'&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'unset'<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
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>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="quickhashintset.getsize.html">QuickHashIntSet::getSize</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="quickhashintset.loadfromstring.html">QuickHashIntSet::loadFromString</a></div>
 <div class="up"><a href="class.quickhashintset.html">QuickHashIntSet</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>