回答編集履歴
3
マークアップ
test
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
※PHP5.3以上ですが
|
2
2
|
|
3
3
|
|
4
|
+
|
5
|
+
```lang-php
|
4
6
|
|
5
7
|
$result = array_reduce(array_keys($lesson), function ($carry, $item) use($lesson) {
|
6
8
|
|
@@ -16,6 +18,6 @@
|
|
16
18
|
|
17
19
|
|
18
20
|
|
21
|
+
var_dump($result);
|
19
22
|
|
20
|
-
|
21
|
-
|
23
|
+
```
|
2
ひとつ余計なアドレス演算子があったので、削除しました
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
$result = array_reduce(array_keys($lesson), function (
|
5
|
+
$result = array_reduce(array_keys($lesson), function ($carry, $item) use($lesson) {
|
6
6
|
|
7
7
|
array_walk($lesson[$item], function ($value) use(&$carry, $item) {
|
8
8
|
|
1
PHPのバージョンを記述
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
※PHP5.3以上ですが
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
$result = array_reduce(array_keys($lesson), function (&$carry, $item) use($lesson) {
|
2
6
|
|
3
7
|
array_walk($lesson[$item], function ($value) use(&$carry, $item) {
|