title: Use one Array to filter result from another array, both are multidimensional
body: <p>I pull one array from a data and one array from an API.</p>
  
  <p>API Array (array1)</p>
  
  <pre><code>...
  [71] =&gt; Array
          (
              [id] =&gt; integer
              [name] =&gt; example_name
              [logo] =&gt; url_of_image
              [lang] =&gt; en
          )
  ...
  </code></pre>
  
  <p>Database API (array2)</p>
  
  <pre><code>    ...
  Array(
      [0] =&gt; integer
      [1] =&gt; integer
  }
      ...
  </code></pre>
  
  <p>I want to use array2 to find any instances of the ID in array1, if they exist then unset the key.</p>
  
  <p>Array diff doesn't work with multidimensional.
  There isn't a common key
  The values are dynamic so i can't hard code them
  Array filter won't take multi commands and doing a foreach results in an error</p>
  
  <blockquote>
    <p>Notice: Array to string conversion in</p>
  </blockquote>
  
  <p>PHP 5.6.</p>
  
  <pre><code>foreach($array2 as $key =&gt; $value) {
     foreach($array1 as $key1 =&gt; $value1) {
        if ($value1 == $value) {
           unset($arrat2[$key])
        }
     }
  }
  </code></pre>
  
  <p>I had this buried somewhere to filter out languages i thought i could stick a foreach inside the function but that throws an array to string conversion.</p>
  
  <pre><code>$filtered = array();
                      $filtered = array_filter($array1, function($el) { return ($el['lang'] == "en"); });
  </code></pre>
  
  <p>Something like:</p>
  
  <pre><code>        $result = array();
              foreach($array2 as $value) {
                  $result = array_filter($array1, function($ee) { return ($ee['id'] != $value); });
              }
  </code></pre>
  
  <p>Results in: </p>
  
  <blockquote>
    <p>Notice: Undefined variable: value i</p>
  </blockquote>
  
  <p>Var dumps array 2:</p>
  
  <pre><code>array(2) {
    [0]=&gt;
    array(1) {
      ["id"]=&gt;
      string(8) "random integer"
    }
    [1]=&gt;
    array(1) {
      ["id"]=&gt;
      string(9) "random integer"
    }
  }
  </code></pre>
  
  <p>var dumps array 1:</p>
  
  <pre><code>array(151) {
    [0]=&gt;
    array(4) {
      ["id"]=&gt;
      int(integer 1)
      ["name"]=&gt;
      string(7) "example name 1"
      ["logo"]=&gt;
      string(97) "image1.png"
      ["lang"]=&gt;
      string(2) "en"
    }
    [1]=&gt;
    array(4) {
      ["id"]=&gt;
      int(integer 2)
      ["name"]=&gt;
      string(10) "example name 2"
      ["logo"]=&gt;
      string(100) "image2.png"
      ["lang"]=&gt;
      string(2) "en"
    }
    [2]=&gt;
    array(4) {
      ["id"]=&gt;
      int(integer 3)
      ["name"]=&gt;
      string(9) "example name 3"
      ["logo"]=&gt;
      string(99) "image3.png"
      ["lang"]=&gt;
      string(2) "en"
    }
  </code></pre>
  
  <p>great answer, also had to make sure my two values were both integers being compared.</p>