I would like to compare the contents of two sub arrays and use that
as a map to create new array out a second arrays values. I need to
find the highest value in the ‘m’ of the first sub array and assign it to
the highest value of ‘t’ in the second sub array. Either of the sub arrays
could have an odd number of values, so there might be four $k=>$v pairs
in one array and three in the other.
Input looks something like this
[code=php]
Array
(
[0] => Array
(
[0] => Array
(
[0] => Array
(
[m] => 4.5 // assigned as second
[….] => [….]
)
[1] => Array
(
[m] => 3 // assigned as third
[….] => [….]
)
[2] => Array
(
[m] => 6 // assigned as first
[….] => [….]
)
)
[1] => Array
(
[0] => Array
(
[t] => 12 // assigned as third
[….] => [….]
)
[1] => Array
(
[t] => 19 // assigned as first
[….] => [….]
)
[2] => Array
(
[t] => 13 // assigned as second
[….] => [….]
)
)
)
[1] => Array
(
//next array
)
)
This would be the map array
[code=php]
Array
(
[0] => Array
(
[0] => [2], // or $t[0][0][0] = $t[0][1][2]
[1] => [0], // or $t[0][0][1] = $t[0][1][0]
[2] => [1], // or $t[0][0][2] = $t[0][1][1]
)
[1] => Array
(
//next array
)
)
The actual array to be rearranged would be this one
[code=php]
Array
(
[0] => Array
(
[0] => Array
(
[0] => ‘foo’,
[1] => ‘bar’,
[2] => ‘baz’,
)
[1] => Array
(
[0] => ‘red’,
[1] => ‘blue’,
[2] => ‘green’,
)
)
[1] => Array
(
//next array
)
)
So the REAL final output would be this, and if possible to return the highest valued
key value pair in both decimal and word as a third array
[code=php]
Array
(
[0] => Array
(
[0] => Array
(
[‘foo’] => [‘green’],
[‘bar’] => [‘red’],
[‘baz’] => [blue],
)
[1] => Array
(
[0] => [‘bar:6’], //highest key-name, highest key value in [0][0]
[1] => [‘red:19’],//highest key-name, highest key value in [0][1]
)
[1] => Array
(
//next array
)
)