title: What is the correct way to use PHP array_diff?
body: <p>I am having trouble understanding the correct way to use <code>array_diff</code> in PHP and whether or not it is the correct function to use in my case.</p>
  
  <p><code>$array1 =</code></p>
  
  <pre><code>Array
  (
      [0] =&gt; 1457543
      [1] =&gt; 1457544
      [2] =&gt; 1461778
      [3] =&gt; 1465640
      [4] =&gt; 1473801
      [5] =&gt; 1474814
      [6] =&gt; 1474815
      [7] =&gt; 1475227
      [8] =&gt; 1478144
      [9] =&gt; 1479478
      [10] =&gt; 1480843
  )
  </code></pre>
  
  <p><code>$array2 =</code></p>
  
  <pre><code>Array
  (
      [0] =&gt; 1336623
      [1] =&gt; 1457543
      [2] =&gt; 1457544
      [3] =&gt; 1461778
      [4] =&gt; 1465640
      [5] =&gt; 1468007
      [6] =&gt; 1474814
      [7] =&gt; 1474815
      [8] =&gt; 1478144
      [9] =&gt; 1479478
      [10] =&gt; 1480843
  )
  </code></pre>
  
  <p>I want to make sure that all numbers present in <code>$array2</code> are also present in <code>$array1</code>.</p>
  
  <p>I would use <code>array_diff($array2, $array1);</code>. Is this correct?</p>
  
  <p>Does <code>array_diff</code> ignore the keys, because I need it to do that, and just check the values, because the keys won't usually be the same in both arrays for the same value as there are missing numbers which is the point in this code to locate.</p>