<!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>Determines if the set contains all values</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ds-set.construct.html">Ds\Set::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="ds-set.copy.html">Ds\Set::copy</a></div> <div class="up"><a href="class.ds-set.html">Set</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="ds-set.contains" class="refentry"> <div class="refnamediv"> <h1 class="refname">Ds\Set::contains</h1> <p class="verinfo">(PECL ds >= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Set::contains</span> — <span class="dc-title">Determines if the set contains all values</span></p> </div> <div class="refsect1 description" id="refsect1-ds-set.contains-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>Ds\Set::contains</strong></span> ([ <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...values</code></span> ] )</div> <p class="para rdfs-comment"> Determines if the set contains all values. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Values of type <span class="type"><a href="language.types.object.html" class="type object">object</a></span> are supported. If an object implements <strong class="classname">Ds\Hashable</strong>, equality will be determined by the object's <code class="code">equals</code> function. If an object does not implement <strong class="classname">Ds\Hashable</strong>, objects must be references to the same instance to be considered equal. </p> </p></blockquote> <div class="caution"><strong class="caution">Caution</strong> <p class="para"> All comparisons are strict (type and value). </p> </div> </div> <div class="refsect1 parameters" id="refsect1-ds-set.contains-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">values</code></dt> <dd> <p class="para"> Values to check. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-ds-set.contains-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> <strong><code>FALSE</code></strong> if any of the provided <code class="parameter">values</code> are not in the set, <strong><code>TRUE</code></strong> otherwise. </p> </div> <div class="refsect1 examples" id="refsect1-ds-set.contains-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-5304"> <p><strong>Example #1 <span class="function"><strong>Ds\Set::contains()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$set </span><span style="color: #007700">= new \</span><span style="color: #0000BB">Ds</span><span style="color: #007700">\</span><span style="color: #0000BB">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 /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">)); </span><span style="color: #FF8000">// true<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</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: #FF8000">// true<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</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: #FF8000">// true<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</span><span style="color: #007700">(</span><span style="color: #DD0000">"1"</span><span style="color: #007700">)); </span><span style="color: #FF8000">// false<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</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">, </span><span style="color: #0000BB">4</span><span style="color: #007700">])); </span><span style="color: #FF8000">// false<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$set</span><span style="color: #007700">-></span><span style="color: #0000BB">contains</span><span style="color: #007700">(...[])); </span><span style="color: #FF8000">// true<br /></span><span style="color: #0000BB">?></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> bool(true) bool(true) bool(true) bool(false) bool(false) bool(true) </pre></div> </div> </div> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ds-set.construct.html">Ds\Set::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="ds-set.copy.html">Ds\Set::copy</a></div> <div class="up"><a href="class.ds-set.html">Set</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>