1
votes

I have this array

$zone = [{"Bertoua Zone 3":[{"code":"BFT50C","product_quantity":"4","zone_name":"Bertoua Zone 3"},{"code":"MNY65C","product_quantity":"10","zone_name":"Bertoua Zone 3"},{"code":"JAP65C","product_quantity":"7","zone_name":"Bertoua Zone 3"},{"code":"MNY65C","product_quantity":"4","zone_name":"Bertoua Zone 3"},{"code":"JAP65C","product_quantity":"3","zone_name":"Bertoua Zone 3"},{"code":"BFT50C","product_quantity":"3","zone_name":"Bertoua Zone 3"},{"code":"JAP65C","product_quantity":"2","zone_name":"Bertoua Zone 3"}],"Bertoua Zone 1":[{"code":"MNY65C","product_quantity":"5","zone_name":"Bertoua Zone 1"},{"code":"JAP65C","product_quantity":"3","zone_name":"Bertoua Zone 1"},{"code":"BFT50C","product_quantity":"7","zone_name":"Bertoua Zone 1"},{"code":"MNY65C","product_quantity":"15","zone_name":"Bertoua Zone 1"},{"code":"JAP65C","product_quantity":"5","zone_name":"Bertoua Zone 1"},{"code":"BFT50C","product_quantity":"4","zone_name":"Bertoua Zone 1"}]}]

i want to get this result

$recapByZone = [{"Bertoua Zone 3":[{"code":"BFT50C","product_quantity":"7","zone_name":"Bertoua Zone 3"},{"code":"MNY65C","product_quantity":"14","zone_name":"Bertoua Zone 3"},{"code":"JAP65C","product_quantity":"12","zone_name":"Bertoua Zone 3"},],"Bertoua Zone 1":[{"code":"MNY65C","product_quantity":"20","zone_name":"Bertoua Zone 1"},{"code":"JAP65C","product_quantity":"8","zone_name":"Bertoua Zone 1"},{"code":"BFT50C","product_quantity":"11","zone_name":"Bertoua Zone 1"}]}]
where is your code!? and what is difference between those to array? - Bhaumik Pandhi