<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.array.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.array-intersect-uassoc.php',
    1 => 'array_intersect_uassoc',
    2 => 'Computes the intersection of arrays with additional index check, compares indexes by a callback function',
  ),
  'up' => 
  array (
    0 => 'ref.array.php',
    1 => 'Array Functions',
  ),
  'prev' => 
  array (
    0 => 'function.array-intersect-key.php',
    1 => 'array_intersect_key',
  ),
  'next' => 
  array (
    0 => 'function.array-intersect-ukey.php',
    1 => 'array_intersect_ukey',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/array/functions/array-intersect-uassoc.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.array-intersect-uassoc" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">array_intersect_uassoc</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">array_intersect_uassoc</span> &mdash; <span class="dc-title">Computes the intersection of arrays with additional index check, compares indexes by a callback function</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.array-intersect-uassoc-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>array_intersect_uassoc</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$array</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">...$arrays</code></span>, <span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$key_compare_func</code></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>array_intersect_uassoc()</strong></span> returns an array
   containing all the values of <code class="parameter">array</code>
   that are present in all the arguments. Note that the keys are used in
   the comparison unlike in <span class="function"><a href="function.array-intersect.php" class="function">array_intersect()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.array-intersect-uassoc-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">array</code></dt>
     <dd>
      <p class="para">
       Initial array for comparison of the arrays.
      </p>
     </dd>
    
    
     <dt><code class="parameter">arrays</code></dt>
     <dd>
      <p class="para">
       Arrays to compare keys against.
      </p>
     </dd>
    
    
     <dt><code class="parameter">key_compare_func</code></dt>
     <dd>
      <p class="para">
 The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
</p>
<div class="methodsynopsis dc-description"><span class="methodname"><span class="replaceable">callback</span></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$a</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$b</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

<div class="caution"><strong class="caution">Caution</strong>
 <p class="para">
  Returning <em>non-integer</em> values from the comparison
  function, such as <span class="type"><a href="language.types.float.php" class="type float">float</a></span>, will result in an internal cast to
  <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> of the callback&#039;s return value. So values such as
  <code class="literal">0.99</code> and <code class="literal">0.1</code> will both be cast to an
  integer value of <code class="literal">0</code>, which will compare such values as equal.
 </p>
</div>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.array-intersect-uassoc-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the values of <code class="parameter">array</code> whose values exist
   in all of the arguments.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.array-intersect-uassoc-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>array_intersect_uassoc()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$array1 </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"green"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"brown"</span><span style="color: #007700">, </span><span style="color: #DD0000">"c" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"blue"</span><span style="color: #007700">, </span><span style="color: #DD0000">"red"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$array2 </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"GREEN"</span><span style="color: #007700">, </span><span style="color: #DD0000">"B" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"brown"</span><span style="color: #007700">, </span><span style="color: #DD0000">"yellow"</span><span style="color: #007700">, </span><span style="color: #DD0000">"red"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">array_intersect_uassoc</span><span style="color: #007700">(</span><span style="color: #0000BB">$array1</span><span style="color: #007700">, </span><span style="color: #0000BB">$array2</span><span style="color: #007700">, </span><span style="color: #DD0000">"strcasecmp"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Array
(
    [b] =&gt; brown
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.array-intersect-uassoc-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.array-intersect.php" class="function" rel="rdfs-seeAlso">array_intersect()</a> - Computes the intersection of arrays</span></li>
    <li><span class="function"><a href="function.array-intersect-assoc.php" class="function" rel="rdfs-seeAlso">array_intersect_assoc()</a> - Computes the intersection of arrays with additional index check</span></li>
    <li><span class="function"><a href="function.array-uintersect-assoc.php" class="function" rel="rdfs-seeAlso">array_uintersect_assoc()</a> - Computes the intersection of arrays with additional index check, compares data by a callback function</span></li>
    <li><span class="function"><a href="function.array-uintersect-uassoc.php" class="function" rel="rdfs-seeAlso">array_uintersect_uassoc()</a> - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions</span></li>
    <li><span class="function"><a href="function.array-intersect-key.php" class="function" rel="rdfs-seeAlso">array_intersect_key()</a> - Computes the intersection of arrays using keys for comparison</span></li>
    <li><span class="function"><a href="function.array-intersect-ukey.php" class="function" rel="rdfs-seeAlso">array_intersect_ukey()</a> - Computes the intersection of arrays using a callback function on the keys for comparison</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>