回答編集履歴
1
スペルミスの修正
answer
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
/**
|
6
6
|
* キー存在チェック (複数キーワードで多次元配列)
|
7
7
|
*/
|
8
|
-
function
|
8
|
+
function array_multi_key_exists_recursive($needles, $haystack)
|
9
9
|
{
|
10
10
|
foreach ($needles as $needle) {
|
11
|
-
if (
|
11
|
+
if (array_key_exists_recursive($needle, $haystack)) {
|
12
12
|
return true;
|
13
13
|
}
|
14
14
|
}
|
@@ -19,7 +19,7 @@
|
|
19
19
|
/**
|
20
20
|
* キー存在チェック (単一キーワードで多次元配列)
|
21
21
|
*/
|
22
|
-
function
|
22
|
+
function array_key_exists_recursive($needle, $haystack)
|
23
23
|
{
|
24
24
|
if (array_key_exists($needle, $haystack)) {
|
25
25
|
return true;
|
@@ -28,7 +28,7 @@
|
|
28
28
|
// 配列があれば、その中身を再帰的に走査
|
29
29
|
foreach ($haystack as $child) {
|
30
30
|
if (is_array($child)
|
31
|
-
&&
|
31
|
+
&& array_key_exists_recursive($needle, $child)
|
32
32
|
) {
|
33
33
|
return true;
|
34
34
|
}
|