<!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>The QuickHashIntStringHash class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="quickhashstringinthash.update.html">QuickHashStringIntHash::update</a></div> <div class="next" style="text-align: right; float: right;"><a href="quickhashintstringhash.add.html">QuickHashIntStringHash::add</a></div> <div class="up"><a href="book.quickhash.html">Quickhash</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.quickhashintstringhash" class="reference"> <h1 class="title">The QuickHashIntStringHash class</h1> <div class="partintro"><p class="verinfo">(PECL quickhash >= Unknown)</p> <div class="section" id="quickhashintstringhash.intro"> <h2 class="title">Introduction</h2> <p class="para"> This class wraps around a hash containing integer numbers, where the values are strings. Hashes are also available as implementation of the ArrayAccess interface. </p> <p class="para"> Hashes can also be iterated over with foreach as the Iterator interface is implemented as well. The order of which elements are returned in is not guaranteed. </p> </div> <div class="section" id="quickhashintstringhash.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">QuickHashIntStringHash</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.quickhashintstringhash.html#quickhashintstringhash.constants.check-for-dupes"><var class="varname">CHECK_FOR_DUPES</var></a></var> <span class="initializer"> = 1</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.quickhashintstringhash.html#quickhashintstringhash.constants.do-not-use-zend-alloc"><var class="varname">DO_NOT_USE_ZEND_ALLOC</var></a></var> <span class="initializer"> = 2</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.quickhashintstringhash.html#quickhashintstringhash.constants.hasher-no-hash"><var class="varname">HASHER_NO_HASH</var></a></var> <span class="initializer"> = 256</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.quickhashintstringhash.html#quickhashintstringhash.constants.hasher-jenkins1"><var class="varname">HASHER_JENKINS1</var></a></var> <span class="initializer"> = 512</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.quickhashintstringhash.html#quickhashintstringhash.constants.hasher-jenkins2"><var class="varname">HASHER_JENKINS2</var></a></var> <span class="initializer"> = 1024</span> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="quickhashintstringhash.add.html" class="methodname">add</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="quickhashintstringhash.construct.html" class="methodname">__construct</a></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 class="initializer"> = 0</span></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="quickhashintstringhash.delete.html" class="methodname">delete</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="quickhashintstringhash.exists.html" class="methodname">exists</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="quickhashintstringhash.get.html" class="methodname">get</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="quickhashintstringhash.getsize.html" class="methodname">getSize</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">QuickHashIntStringHash</span> <span class="methodname"><a href="quickhashintstringhash.loadfromfile.html" class="methodname">loadFromFile</a></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 class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">QuickHashIntStringHash</span> <span class="methodname"><a href="quickhashintstringhash.loadfromstring.html" class="methodname">loadFromString</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$contents</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="quickhashintstringhash.savetofile.html" class="methodname">saveToFile</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="quickhashintstringhash.savetostring.html" class="methodname">saveToString</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="quickhashintstringhash.set.html" class="methodname">set</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="quickhashintstringhash.update.html" class="methodname">update</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span> )</div> }</div> </div> <div class="section" id="quickhashintstringhash.constants"> <h2 class="title">Predefined Constants</h2> <dl> <dt id="quickhashintstringhash.constants.check-for-dupes"> <span class="term"><strong><code>QuickHashIntStringHash::CHECK_FOR_DUPES</code></strong></span> <dd> <p class="para">If enabled, adding duplicate elements to a set (through either add() or loadFromFile()) will result in those elements to be dropped from the set. This will take up extra time, so only used when it is required.</p> </dd> </dt> <dt id="quickhashintstringhash.constants.do-not-use-zend-alloc"> <span class="term"><strong><code>QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC</code></strong></span> <dd> <p class="para">Disables the use of PHP's internal memory manager for internal set structures. With this option enabled, internal allocations will not count towards the memory_limit settings.</p> </dd> </dt> <dt id="quickhashintstringhash.constants.hasher-no-hash"> <span class="term"><strong><code>QuickHashIntStringHash::HASHER_NO_HASH</code></strong></span> <dd> <p class="para">Selects to not use a hashing function, but merely use a modulo to find the bucket list index. This is not faster than normal hashing, and gives more collisions.</p> </dd> </dt> <dt id="quickhashintstringhash.constants.hasher-jenkins1"> <span class="term"><strong><code>QuickHashIntStringHash::HASHER_JENKINS1</code></strong></span> <dd> <p class="para">This is the default hashing function to turn the integer hashes into bucket list indexes.</p> </dd> </dt> <dt id="quickhashintstringhash.constants.hasher-jenkins2"> <span class="term"><strong><code>QuickHashIntStringHash::HASHER_JENKINS2</code></strong></span> <dd> <p class="para">Selects a variant hashing algorithm.</p> </dd> </dt> </dl> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="quickhashintstringhash.add.html">QuickHashIntStringHash::add</a> — This method adds a new entry to the hash</li><li><a href="quickhashintstringhash.construct.html">QuickHashIntStringHash::__construct</a> — Creates a new QuickHashIntStringHash object</li><li><a href="quickhashintstringhash.delete.html">QuickHashIntStringHash::delete</a> — This method deletes am entry from the hash</li><li><a href="quickhashintstringhash.exists.html">QuickHashIntStringHash::exists</a> — This method checks whether a key is part of the hash</li><li><a href="quickhashintstringhash.get.html">QuickHashIntStringHash::get</a> — This method retrieves a value from the hash by its key</li><li><a href="quickhashintstringhash.getsize.html">QuickHashIntStringHash::getSize</a> — Returns the number of elements in the hash</li><li><a href="quickhashintstringhash.loadfromfile.html">QuickHashIntStringHash::loadFromFile</a> — This factory method creates a hash from a file</li><li><a href="quickhashintstringhash.loadfromstring.html">QuickHashIntStringHash::loadFromString</a> — This factory method creates a hash from a string</li><li><a href="quickhashintstringhash.savetofile.html">QuickHashIntStringHash::saveToFile</a> — This method stores an in-memory hash to disk</li><li><a href="quickhashintstringhash.savetostring.html">QuickHashIntStringHash::saveToString</a> — This method returns a serialized version of the hash</li><li><a href="quickhashintstringhash.set.html">QuickHashIntStringHash::set</a> — This method updates an entry in the hash with a new value, or adds a new one if the entry doesn't exist</li><li><a href="quickhashintstringhash.update.html">QuickHashIntStringHash::update</a> — This method updates an entry in the hash with a new value</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="quickhashstringinthash.update.html">QuickHashStringIntHash::update</a></div> <div class="next" style="text-align: right; float: right;"><a href="quickhashintstringhash.add.html">QuickHashIntStringHash::add</a></div> <div class="up"><a href="book.quickhash.html">Quickhash</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>