在匹配时将不同的阵列单元组合到一个阵列

I can not wrap my head around how to do the following. I have two different lenght and different dimensional arrays that I want to combine so that the result array will have arrays1 + array2 cell that did not match.

This should help you understand what I mean

$dbquery_results1[0][] = array("1","5","b99");
$dbquery_results1[1][] = array("4","12","www");
$dbquery_results1[2][] = array("10","32","ccc");
$dbquery_results1[3][] = array("7","142","xx");

$dbquery_results2[0][] = array("c","10");
$dbquery_results2[1][] = array("as","1");
$dbquery_results2[2][] = array("fe","7");

$dbquery_combination[0][] = array("1","5","b99","as");
$dbquery_combination[1][] = array("7","142","xx","fe");

What I would like to get done

      $i=0;
 while(!empty($dbquery_results1[$i][0])) {
        If($dbquery_results1[$i][0] == $dbquery_results2[any of the dimensions here][2])  
          {
              $dbquery_combination[] = $dbquery_results1[$i][]+ $dbquery_results2[x-dimension][2];
         }  $i++;
            }

So only if array1 has at [][0] same value as array2 [any dimension][1] will array1 + the array2 cell that is different be saved at array3.

Sorry that I am not too good expressing myself. Thanks a lot in advance.

So if you don't have the choice you can do it like this :

<?php
$dbquery_results1[0] = array("1","5","b99");
$dbquery_results1[1] = array("4","12","www");
$dbquery_results1[2] = array("10","32","ccc");
$dbquery_results1[3] = array("7","142","xx");

$dbquery_results2[0] = array("c","10");
$dbquery_results2[1] = array("as","1");
$dbquery_results2[2] = array("fe","7");

foreach($dbquery_results1 as $line_r1)
{
    foreach($dbquery_results2 as $line_r2)
    {
        if($line_r1[0] == $line_r2[1])
        {
            $line = $line_r1;
            $line[] = $line_r2[0];

            $dbquery_combination[] = $line;
        }
    }
}

print_r($dbquery_combination);
?>

And the result is :

Array (
        [0] => Array ( [0] => 1 [1] => 5 [2] => b99 [3] => as )
        [1] => Array ( [0] => 10 [1] => 32 [2] => ccc [3] => c )
        [2] => Array ( [0] => 7 [1] => 142 [2] => xx [3] => fe )
      )

I think you are complicating the problem. I suppose that your array are the result of SQL request ? If it's the case, you should prefer to use joint SQL request.

//Coment Answer : Are they on the same server ? If yes, you can make request on multiple database at the same time by specifying full qualification.