title: Set Theory Union of arrays in PHP
body: <p>There are 3 operations with sets in mathematics: intersection, difference and union (unification). In PHP we can do this operations with arrays:</p>
  
  <ul>
  <li>intersection: <code>array_intersect</code></li>
  <li>difference: <code>array_diff</code></li>
  </ul>
  
  <p><strong>What function is for union?</strong> </p>
  
  <p>No duplicates can be in the result array (like <code>array_intersect</code> and <code>array_diff</code>).</p>
  
  <p>If indexes are numeric then <code>array_merge</code> will not overwrite the original value, but will be appended (<a href="http://www.php.net/manual/en/function.array-merge.php" rel="noreferrer">PHP docs</a>). </p>