PHP检查数组的数组是否至少在其中一个数组中具有键的搜索值

PHP检查数组的数组是否至少在其中一个数组中具有键的搜索值,php,arrays,Php,Arrays,我有一个数组,包含每天游戏的数据: "days" => [ "2019-07-31" => [ "3" => [ 'id' => 3, 'type' => normal, 'teams' => [ 'teamA', 'teamB', ], 'winnerTeam' => 'team

我有一个数组,包含每天游戏的数据:

"days" => [
    "2019-07-31" => [
        "3" => [
            'id' => 3,
            'type' => normal,
            'teams' => [
                'teamA', 'teamB',
            ],
            'winnerTeam' => 'teamB',
        ],
        "4" => [
            'id' => 4,
            'type' => ranked,
            'teams' => [
                'teamC', 'teamD',
            ],
            'winnerTeam' => 'teamC',
        ],
    ],
    "2019-07-30" => [
        "1" => [
            'id' => 1,
            'type' => normal,
            'teams' => [
                'teamA', 'teamC',
            ],
            'winnerTeam' => 'teamA',
        ],
        "2" => [
            'id' => 2,
            'type' => normal,
            'teams' => [
                'teamB', 'teamD',
            ],
            'winnerTeam' => 'teamC',
        ],
    ],
];
我想获得所有排名游戏的数据,但在此之前,我想检查是否有任何排名游戏发生在这几天。有人知道比每件事都更优雅的方法吗?因此,我的目标是在获取数据之前检查是否有任何
游戏['type']=='classed'

您可以使用并实现这一点

每天使用
array\u列
获取所有类型,然后对其进行计数,如果在返回数组中设置了类型“ranked”,则返回

考虑以下几点:

foreach($arr["days"] as $day => $a) {
    $aaa = array_count_values(array_column($a, "type"));
    if (isset($aaa['ranked'])) 
        echo "Found in $day \n";
}

实例:

我的意思是你可以对它进行json编码并搜索字符串。