質問編集履歴
2
試したことを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -120,7 +120,7 @@
|
|
120
120
|
|
121
121
|
$sum = array_sum(array_column($arr,['r1'].['c2']));
|
122
122
|
|
123
|
-
|
123
|
+
echo $sum;
|
124
124
|
|
125
125
|
<?php
|
126
126
|
|
1
試したことを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,6 +90,48 @@
|
|
90
90
|
|
91
91
|
|
92
92
|
|
93
|
+
###試したこと
|
94
|
+
|
95
|
+
```PHP
|
96
|
+
|
97
|
+
//一つずつターミナル上で確認してみた
|
98
|
+
|
99
|
+
$arr = [
|
100
|
+
|
101
|
+
'r1' => ['c1' => 10, 'c2' => 5, 'c3' => 20],
|
102
|
+
|
103
|
+
'r2' => ['c1' => 7, 'c2' => 8, 'c3' => 12],
|
104
|
+
|
105
|
+
'r3' => ['c1' => 25, 'c2' => 9, 'c3' => 130]
|
106
|
+
|
107
|
+
];
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
//配列の確認
|
112
|
+
|
113
|
+
print_r($arr);
|
114
|
+
|
115
|
+
//配列の出力
|
116
|
+
|
117
|
+
echo $arr['r3']['c2'];
|
118
|
+
|
119
|
+
//配列の計算 うまくいかず
|
120
|
+
|
121
|
+
$sum = array_sum(array_column($arr,['r1'].['c2']));
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<?php
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
?>
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
|
93
135
|
### 補足情報(FW/ツールのバージョンなど)
|
94
136
|
|
95
137
|
|