重複の可能性:
配列の印刷
public function computeGHComponents()
{
error_reporting (E_ALL^ E_NOTICE);
$total = null;
$result=array();
foreach ($this->transaction as $t){
$amount = (float) $t['Amount'];
if (isset($this->totals[ $t['SiteID'] ][ $t['TransactionType'] ])){
$this->totals[ $t['SiteID'] ][ $t['TransactionType'] ] += (float) $amount;
} else {
$this->totals[ $t['SiteID'] ][ $t['TransactionType'] ] = (float) $amount;
}
}
foreach($this->totals as $key => $value)
{
$result = array_merge($result,array($key=>array("Deposit"=>$value['D'],"Redemption"=>$value['W'],"Reload"=>$value['R'])));
}
print_r($result);
}
キーは SiteID である必要があります。どうすればそれを行うことができますか?
この種の出力が必要です:
array ([147]=>array([Deposit] => "total amount", [Reload]=> "total amount" [Redemption]=> "total amount"))
array ([150]=>array([Deposit] => "total amount", [Reload]=> "total amount" [Redemption]=> "total amount"))
array ([3]=> array([Deposit] => "total amount", [Reload]=> "total amount" [Redemption]=> "total amount"))
キーは SiteID である必要があります。コードを修正してください:(