I have one flat array that I use to generate a tree later on:
[0] => array
[0] => 1
[1] => 3
[1] => array
[0] => 3
[1] => 5
[2] => array
[0] => 8
[1] => 12
[3] => array
[0] => 4
[1] => 7
The values in this array are plain id's, I want to convert them into full names. I can get those names from the database, with corresponding id's, so that's my sample output array:
[0] => array
['id'] => 1
['name'] => 'sample name'
[1] => array
['id'] => 2
['name'] => 'foo'
[2] => array
['id'] => 3
['name'] => 'bar'
So now I have to iterate over the first array, and compare each value to the value from the second array...How can I do that without using foreach loop in every iteration of the external loop?
Thanks!