<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/class.ds-set.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'ds-set.union.php', 1 => 'Ds\\Set::union', 2 => 'Creates a new set using values from the current instance and another set', ), 'up' => array ( 0 => 'class.ds-set.php', 1 => 'Ds\\Set', ), 'prev' => array ( 0 => 'ds-set.toarray.php', 1 => 'Ds\\Set::toArray', ), 'next' => array ( 0 => 'ds-set.xor.php', 1 => 'Ds\\Set::xor', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/set/union.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="ds-set.union" class="refentry"> <div class="refnamediv"> <h1 class="refname">Ds\Set::union</h1> <p class="verinfo">(PECL ds >= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Set::union</span> — <span class="dc-title">Creates a new set using values from the current instance and another set</span></p> </div> <div class="refsect1 description" id="refsect1-ds-set.union-description"> <h3 class="title">说明</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>Ds\Set::union</strong></span>(<span class="methodparam"><span class="type"><a href="class.ds-set.php" class="type Ds\Set">Ds\Set</a></span> <code class="parameter">$set</code></span>): <span class="type"><a href="class.ds-set.php" class="type Ds\Set">Ds\Set</a></span></div> <p class="para rdfs-comment"> Creates a new set that contains the values of the current instance as well as the values of another <code class="parameter">set</code>. </p> <p class="para"> <code class="code">A ∪ B = {x: x ∈ A ∨ x ∈ B}</code> </p> </div> <div class="refsect1 parameters" id="refsect1-ds-set.union-parameters"> <h3 class="title">参数</h3> <dl> <dt><code class="parameter">set</code></dt> <dd> <p class="para"> The other set, to combine with the current instance. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-ds-set.union-returnvalues"> <h3 class="title">返回值</h3> <p class="para"> A new set containing all the values of the current instance as well as another <code class="parameter">set</code>. </p> </div> <div class="refsect1 seealso" id="refsect1-ds-set.union-seealso"> <h3 class="title">参见</h3> <p class="para"> <ul class="simplelist"> <li><a href="https://en.wikipedia.org/wiki/Union_(set_theory)" class="link external">» Union</a> on Wikipedia</li> </ul> </p> </div> <div class="refsect1 examples" id="refsect1-ds-set.union-examples"> <h3 class="title">示例</h3> <div class="example" id="example-4426"> <p><strong>示例 #1 <span class="function"><strong>Ds\Set::union()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$a </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Set</span><span style="color: #007700">([</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">$b </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Set</span><span style="color: #007700">([</span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #0000BB">5</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">-></span><span style="color: #0000BB">union</span><span style="color: #007700">(</span><span style="color: #0000BB">$b</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">object(Ds\Set)#3 (5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) }</pre> </div> </div> </div> </div> </div><?php manual_footer($setup); ?>