Введите
$array = array
(
array
(
"idClient" => 101,
"Month" => "01",
"monthTotal" => "900.00",
),
array
(
"idClient" => 101,
"Month" => "02",
"monthTotal" => "100.00",
),
array
(
"idClient" => 102,
"Month" => "02",
"monthTotal" => "400.00",
),
array
(
"idClient" => 103,
"Month" => "03",
"monthTotal" => "300.00",
),
array
(
"idClient" => 103,
"Month" => "01",
"monthTotal" => "100.00",
),
array
(
"idClient" => 103,
"Month" => "02",
"monthTotal" => "200.00",
)
);
PHP Script
$narray = array();
if ($array) {
foreach($array as $key => $value){
if(!array_key_exists($value['idClient'],$narray)){
$narray[$value['idClient']] = array();
}
$narray[$value['idClient']][$value['Month']] = $value['monthTotal'];
}
}
print_r($narray);
выход
Array
(
[101] => Array
(
[01] => 900.00
[02] => 100.00
)
[102] => Array
(
[02] => 400.00
)
[103] => Array
(
[03] => 300.00
[01] => 100.00
[02] => 200.00
)
)