在PHP中根据不同的数组查找数组值

Not sure how I had to describe the title, but my current problem looks like this:

I have two arrays, one looks like this (including surrounding code):

$element = $html->find('table',3); 
        $i = 0; 
        foreach($element->find('tr') as $row){ 
        if($i >= 2){ 
          $lapno = $row->find('td',0)->plaintext;  
          $tyre = $row->find('td',3)->plaintext; 

          $racelap[$i] = Array(); 
          $racelap[$i][0] = $lapno; 
          $racelap[$i][1] = $tyre; 
        } 
          $i+=1;
    }

And the second array looks like this, also within a (different) foreach statement:

$stop[$i] = Array(); 
          $stop[$i][0] = $pitno; 
          $stop[$i][1] = $pitlap;  

Now I have to add this part from the first array: $racelap[$i][1] = $tyre; to $pitstop[$i][2] in the second array. I've tried to do it like this, but it didn't work:

$racelap[$stop[$i][1]][1]

for example $stop[1][1] has to show the result of $tyre in the specific pitlap.

Hope I explained it well enough and someone can help me :)

Your problem is that $racelap is an array index by $i and not by $lapno. if you replace numeric index array by an associative array like that :

$racelap[$lapno]=$tyre;

you can do :

$pitstop[$i][2]=$racelap[$stop[$i][1]];