<p>I have two arrays. One contains <code>id=&gt;count</code> and the other contains <code>id=&gt;name</code>. I'm trying to produce a single array that is <code>name=&gt;count</code>. Any suggestions on a straightforward way to do this?</p>

<p>I have looked at the <a href="http://us2.php.net/manual/en/ref.array.php" rel="nofollow noreferrer">Array Functions in the PHP Manual</a> and didn't see anything that stood out as doing what I want, so I'm guessing I'll need a combination of functions, but I'm having trouble coming up with something that's not convoluted.</p>

Something like:
```
```
foreach($countA as $id => $count)
{
    $newArray[$nameA[$id]] = $count;
}
```
```
This does assume that the keys are in correspondence between the two arrays, since your requirements are ambiguous otherwise.