-1
私は配列を持っており、次のように返します。その値を追加する必要がありますが、アカウント "cuenta"、ブランチ "ramo"、サブブランチ "subramo"、特定の "especifica"または特定の "subespecifica"に依存します。多次元PHP配列の合計
array(5) {
[0]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "2"
["especifica"]=>
string(2) "19"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "354.00"
}
[1]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "2"
["especifica"]=>
string(2) "11"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "543.74"
}
[2]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "2"
["especifica"]=>
string(2) "11"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "985.54"
}
[3]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "1"
["especifica"]=>
string(1) "8"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "177.00"
}
[4]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "1"
["especifica"]=>
string(1) "2"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(5) "88.50"
}
}
私が今述べたことに応じて合計額を返す必要があります。
array(4) {
[0]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "2"
["especifica"]=>
string(2) "19"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "354.00"
}
[1]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "2"
["especifica"]=>
string(2) "11"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "1529.28"
}
[2]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "1"
["especifica"]=>
string(1) "8"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(6) "177.00"
}
[3]=>
array(6) {
["cuenta"]=>
string(1) "1"
["ramo"]=>
string(1) "1"
["subramo"]=>
string(1) "1"
["especifica"]=>
string(1) "2"
["subespecifica"]=>
string(1) "0"
["costo"]=>
string(5) "88.50"
}
}