title: PHP array_keys multiple levels
body: <p>I have array1 like this:</p>
  
  <pre><code>Array
  (
  [0] =&gt; 123
  [1] =&gt; 456
  [2] =&gt; 789
  )
  </code></pre>
  
  <p>And array 2 like this</p>
  
  <pre><code> Array
   (
  
   [0] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 888
          [2] =&gt; some
          [3] =&gt; text
      )
    [1] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )
    [2] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 999
          [2] =&gt; some
          [3] =&gt; text
      )   
     [3] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; Array
              (
                  [1] =&gt; 456
                  [2] =&gt; 789
              )
          [2] =&gt; some
          [3] =&gt; text
      ) 
     [4] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )   
    )
  </code></pre>
  
  <p>I am checking only 1. column of second array and finding values that match values from first array. This is my code:</p>
  
  <pre><code> $test=array();
  
   $xcol = array_column($array2, 1);
   foreach( $array1 as $key =&gt; $value ) {
   if( ($foundKey = array_keys($xcol, $value)) !== false ) {
   $rrt=$foundKey;
   foreach($rrt as $rte){
    $test[]=$array2[$rte];
  }
  }
  }
  
  echo "&lt;pre&gt;";
  print_r($test);
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>It is working and giving me proper results but it does not check for all levels. Can anybody please point me what am I doing wrong?
  My output is:</p>
  
  <pre><code>Array
   (
  
    [0] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )
     [1] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )   
     )
  </code></pre>
  
  <p>And desired output is:</p>
  
  <pre><code>Array
   (
  
    [0] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )
     [1] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; Array
              (
                  [1] =&gt; 456
                  [2] =&gt; 789
              )
          [2] =&gt; some
          [3] =&gt; text
      ) 
     [2] =&gt; Array
      (
          [0] =&gt; some text
          [1] =&gt; 123
          [2] =&gt; some
          [3] =&gt; text
      )   
     )
  </code></pre>