i am having a 2-dimensional array $a like this:
Array (
[1] => Array (
[id] => 19
[name] => SomeName
),
[2] => Array (
[id] => 23
[name] => AnotherName
),
[3] => Array (
[id] => 45
[name] => OneMoreName
)
)
And the second array $b like this:
Array (
[0] => 45
[1] => 23
[2] => 19
)
The values of 2nd array are id's from first array. The order of elements is right in 2nd array, but is not right in 1st. So, i want to re-order elements in 1st array to have finally:
Array (
[1] => Array (
[id] => 45
[name] => OneMoreName
),
[2] => Array (
[id] => 23
[name] => AnotherName
),
[3] => Array (
[id] => 19
[name] => SomeName
)
)
Of course, the number of elements can be more than 3, but in both arrays it is always the same. What standart php function or what approach can i use to do this?