<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/class.quickhashinthash.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'quickhashinthash.update.php', 1 => 'QuickHashIntHash::update', 2 => 'This method updates an entry in the hash with a new value', ), 'up' => array ( 0 => 'class.quickhashinthash.php', 1 => 'QuickHashIntHash', ), 'prev' => array ( 0 => 'quickhashinthash.set.php', 1 => 'QuickHashIntHash::set', ), 'next' => array ( 0 => 'class.quickhashstringinthash.php', 1 => 'QuickHashStringIntHash', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/quickhash/quickhashinthash/update.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="quickhashinthash.update" class="refentry"> <div class="refnamediv"> <h1 class="refname">QuickHashIntHash::update</h1> <p class="verinfo">(PECL quickhash >= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntHash::update</span> — <span class="dc-title">This method updates an entry in the hash with a new value</span></p> </div> <div class="refsect1 description" id="refsect1-quickhashinthash.update-description"> <h3 class="title">说明</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>QuickHashIntHash::update</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="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 updates an entry with a new value, and returns whether the entry was update. If there are duplicate keys, only the first found element will get an updated value. Use <strong><code><a href="class.quickhashinthash.php#quickhashinthash.constants.check-for-dupes">QuickHashIntHash::CHECK_FOR_DUPES</a></code></strong> during hash creation to prevent duplicate keys from being part of the hash. </p> </div> <div class="refsect1 parameters" id="refsect1-quickhashinthash.update-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 update. </p> </dd> <dt><code class="parameter">value</code></dt> <dd> <p class="para"> The new value to update the entry with. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-quickhashinthash.update-returnvalues"> <h3 class="title">返回值</h3> <p class="para"> <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> when the entry was found and updated, and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the entry was not part of the hash already. </p> </div> <div class="refsect1 examples" id="refsect1-quickhashinthash.update-examples"> <h3 class="title">示例</h3> <p class="para"> <div class="example" id="example-5413"> <p><strong>示例 #1 <span class="function"><strong>QuickHashIntHash::update()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$hash </span><span style="color: #007700">= new </span><span style="color: #0000BB">QuickHashIntHash</span><span style="color: #007700">( </span><span style="color: #0000BB">1024 </span><span style="color: #007700">);<br /><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: #0000BB">141421</span><span style="color: #007700">, </span><span style="color: #0000BB">173205 </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">update</span><span style="color: #007700">( </span><span style="color: #0000BB">141421</span><span style="color: #007700">, </span><span style="color: #0000BB">223606 </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: #0000BB">141421 </span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>以上示例的输出类似于:</p></div> <div class="example-contents screen"> <div class="examplescode"><pre class="examplescode">bool(true) bool(true) int(223606)</pre> </div> </div> </div> </p> </div> </div><?php manual_footer($setup); ?>