I have the following 2 arrays:
Array 1
(
[0] => Speed
[1] => Grade
[2] => Speed
[3] => Grade
[4] => Speed
[5] => Grade
[6] => Grade
[7] => Speed
[8] => Size
)
Array 2
(
[0] => 5200 rpm
[1] => Red
[2] => 7200 rpm
[3] => Blue
[4] => 8900 rpm
[5] => Green
[6] => Purple
[7] => 10000 rpm
[8] => Big
)
The values are matching each other. For example: Speed - 5200 rpm , Grade - Red and so forth.
I need to make the above like the following :
$collection = array(
"Speed" => array (
5200 rpm,
7200 rpm,
8900 rpm,
10000 rpm
),
"Grade" => array (
Red,
Blue,
Green,
Purple
),
"Size" => array (
Big
)
);
It needs to make an array for each label and store the necessary values into the array. I have tried merging and combining and looping. I am going wrong somewhere.
Can someone please help me out.