Using array:
Array
(
[0] => Array
(
[description] => EXAMI
[pcchrgamt] => 190.00
[pchrgqty] => 1.00
[pchrgup] => 190.00
)
[1] => Array
(
[description] => EXAMI
[pcchrgamt] => 40.00
[pchrgqty] => 1.00
[pchrgup] => 40.00
)
)
I get :
Array
(
[description] => 0
[pcchrgamt] => 230
[pchrgqty] => 2
[pchrgup] => 230
)
Using :
print_r( $rows1 );
$sumArray = array();
foreach ($rows1 as $k=>$subArray) {
foreach ($subArray as $id=>$value) {
$sumArray[$id]+=$value;
}
}
print_r($sumArray);
What I wanted to get is :
Array
(
[0] => Array
(
[description] => EXAMI
[pcchrgamt] => 230
[pchrgqty] => 2
[pchrgup] => 230
)
)
Meaning I just want to combine only numeric amount.
Also I dont know how to handle :
Array
(
[0] => Array
(
[description] => EXAMI
[pcchrgamt] => 190.00
[pchrgqty] => 1.00
[pchrgup] => 190.00
)
[1] => Array
(
[description] => EXAMI
[pcchrgamt] => 40.00
[pchrgqty] => 1.00
[pchrgup] => 40.00
)
[2] => Array
(
[description] => EXAMI1
[pcchrgamt] => 190.00
[pchrgqty] => 1.00
[pchrgup] => 190.00
)
[3] => Array
(
[description] => EXAMI1
[pcchrgamt] => 40.00
[pchrgqty] => 1.00
[pchrgup] => 40.00
)
)
I want to combine based on description and from above I want to get :
Array
(
[0] => Array
(
[description] => EXAMI
[pcchrgamt] => 230
[pchrgqty] => 2
[pchrgup] => 230
)
[1] => Array
(
[description] => EXAMI1
[pcchrgamt] => 230
[pchrgqty] => 2
[pchrgup] => 230
)
)
Description could be many , there could be many and there could be a unique at the same time.
How to proceed with these