Hello I have this array:
Array
(
[2018/03/01] => Array
(
[0] => Array
(
[BIL_Date] => 2018/03/01
[BIL_RateNonTaxed] => 105.00
[BIL_RateTaxed] => 115.500000000
[BIL_Status] => notcharged
)
[1] => Array
(
[BIL_Date] => 2018/03/01
[BIL_RateNonTaxed] => 60.00
[BIL_RateTaxed] => 63.000000000
[BIL_Status] => charged
)
[2] => Array
(
[BIL_Date] => 2018/03/01
[BIL_RateNonTaxed] => 21.00
[BIL_RateTaxed] => 25.194750000
[BIL_Status] => notcharged
)
)
)
How can I merge some datas to have something like this ?
I search to group by date, item charged
and notcharged
.
Array
(
[2018/03/01] => Array
(
[notcharged] => Array
(
[BIL_RateNonTaxed] => 126.00
[BIL_RateTaxed] => 140.69475
)
[charged] => Array
(
[BIL_RateNonTaxed] => 60.00
[BIL_RateTaxed] => 63.000000000
)
)
)
Here what I tried:
$datas = array();
foreach ($array as $key => $element) {
$datas[$key][] = "BIL_RateNonTaxed" => $key['BIL_RateNonTaxed'];
$datas[$key][] = "BIL_RateTaxed" => $key['BIL_RateTaxed'];
}
Could you please help me with this please ?
Thanks.