<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/class.quickhashstringinthash.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'quickhashstringinthash.add.php', 1 => 'QuickHashStringIntHash::add', 2 => 'This method adds a new entry to the hash', ), 'up' => array ( 0 => 'class.quickhashstringinthash.php', 1 => 'QuickHashStringIntHash', ), 'prev' => array ( 0 => 'class.quickhashstringinthash.php', 1 => 'QuickHashStringIntHash', ), 'next' => array ( 0 => 'quickhashstringinthash.construct.php', 1 => 'QuickHashStringIntHash::__construct', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/quickhash/quickhashstringinthash/add.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="quickhashstringinthash.add" class="refentry"> <div class="refnamediv"> <h1 class="refname">QuickHashStringIntHash::add</h1> <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">QuickHashStringIntHash::add</span> — <span class="dc-title">This method adds a new entry to the hash</span></p> </div> <div class="refsect1 description" id="refsect1-quickhashstringinthash.add-description"> <h3 class="title">Beschreibung</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>QuickHashStringIntHash::add</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$value</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 adds a new entry to the hash, and returns whether the entry was added. Entries are by default always added unless <strong><code><a href="class.quickhashstringinthash.php#quickhashstringinthash.constants.check-for-dupes">QuickHashStringIntHash::CHECK_FOR_DUPES</a></code></strong> has been passed when the hash was created. </p> </div> <div class="refsect1 parameters" id="refsect1-quickhashstringinthash.add-parameters"> <h3 class="title">Parameter-Liste</h3> <p class="para"> <dl> <dt><code class="parameter">key</code></dt> <dd> <p class="para"> The key of the entry to add. </p> </dd> <dt><code class="parameter">value</code></dt> <dd> <p class="para"> The value of the entry to add. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-quickhashstringinthash.add-returnvalues"> <h3 class="title">Rückgabewerte</h3> <p class="para"> <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> when the entry was added, and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the entry was not added. </p> </div> <div class="refsect1 examples" id="refsect1-quickhashstringinthash.add-examples"> <h3 class="title">Beispiele</h3> <p class="para"> <div class="example" id="example-5436"> <p><strong>Beispiel #1 <span class="function"><strong>QuickHashStringIntHash::add()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"without dupe checking\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashStringIntHash</span><span style="color: #007700">( </span><span style="color: #0000BB">1024 </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #DD0000">"four"</span><span style="color: #007700">, </span><span style="color: #0000BB">22 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #DD0000">"four"</span><span style="color: #007700">, </span><span style="color: #0000BB">12 </span><span style="color: #007700">) );<br /><br />echo </span><span style="color: #DD0000">"\nwith dupe checking\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashStringIntHash</span><span style="color: #007700">( </span><span style="color: #0000BB">1024</span><span style="color: #007700">, </span><span style="color: #0000BB">QuickHashStringIntHash</span><span style="color: #007700">::</span><span style="color: #0000BB">CHECK_FOR_DUPES </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash </span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #DD0000">"four"</span><span style="color: #007700">, </span><span style="color: #0000BB">78 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">get</span><span style="color: #007700">( </span><span style="color: #DD0000">"four" </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">( </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-></span><span style="color: #0000BB">add</span><span style="color: #007700">( </span><span style="color: #DD0000">"four"</span><span style="color: #007700">, </span><span style="color: #0000BB">9 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:</p></div> <div class="example-contents screen"> <div class="examplescode"><pre class="examplescode">without dupe checking object(QuickHashStringIntHash)#1 (0) { } bool(false) bool(false) bool(true) bool(true) int(22) bool(true) with dupe checking object(QuickHashStringIntHash)#2 (0) { } bool(false) bool(false) bool(true) bool(true) int(78) bool(false)</pre> </div> </div> </div> </p> </div> </div><?php manual_footer($setup); ?>