I have multidimensional array like below.
Array
(
[0] => stdClass Object
(
[LOCATIONNAME] => test warehouse
[CATEGORYNAME] => Fruites
[PRODUCTNAME] => 1 - apple
[UNITS] => 8
)
[1] => stdClass Object
(
[LOCATIONNAME] => General
[CATEGORYNAME] => Fruites
[PRODUCTNAME] => 10003 - Grapes
[UNITS] => 7
)
[2] => stdClass Object
(
[LOCATIONNAME] => test warehouse
[CATEGORYNAME] => Fruites
[PRODUCTNAME] => 10003 - Grapes
[UNITS] => 12
)
[3] => stdClass Object
(
[LOCATIONNAME] => General
[CATEGORYNAME] => Standard
[PRODUCTNAME] => 10001 - Chicken Burger
[UNITS] => 12
)
[4] => stdClass Object
(
[LOCATIONNAME] => test warehouse
[CATEGORYNAME] => Standard
[PRODUCTNAME] => 10001 - Chicken Burger
[UNITS] => 17
)
[5] => stdClass Object
(
[LOCATIONNAME] => General
[CATEGORYNAME] => Standard
[PRODUCTNAME] => 10002 - Sandwitch
[UNITS] => 5
)
)
I want to group the above array with the below array elements;
Array
(
[0] => CATEGORYNAME
[1] => PRODUCTNAME
)
I want group the first array with the second array elements and summarize that( eg. sum each warehouse's quantity).I did this already but i cannot summarize the elements by the category
I want to print this array as below click to view
Is it possible to group an array with another array elements.It would be great if you can help me.