title: Comparing 2-Dimensional and 1-Dimensional Arrays
body: <p>I have searched the site but struggling to find how to achieve what I am hoping to.  I am dynamically creating the below array, then sorting it. Now that I have done that I want to compare the second level keys [35659] etc.. to values in another array.</p>
  
  <pre><code>Array
  (
      [11] =&gt; Array
          (
              [35659] =&gt; 1
              [35735] =&gt; 2
          )
      [199] =&gt; Array
          (
              [35659] =&gt; 1
              [35699] =&gt; 1
          )
      [118] =&gt; Array
          (
              [35659] =&gt; 1
          )
  )
  </code></pre>
  
  <p>This is other array that holds product id's</p>
  
  <pre><code>Array
  (
      [0] =&gt; 35659
      [1] =&gt; 35699
      [2] =&gt; 35735
  )
  </code></pre>
  
  <p>So what I am trying to achieve is while the 2nd array values exist in the first array print them out once each productid has been met once I want to break. </p>
  
  <p>So my desired outcome would be the below, as all three values from the product id's array have been met. </p>
  
  <pre><code>   [11] =&gt; Array
          (
              [35659] =&gt; 1
              [35735] =&gt; 2
          )
  
    [199] =&gt; Array
          (
              [35699] =&gt; 1
          )
  </code></pre>
  
  <p>Any guidance on this would be greatly appreciated. </p>