如果为null,则不会使用array_count_values发出警告

In a cakephp model i writed direct counter like this

        // array_layers_count
        $array_layers = array($val['Zombiesindexstats']['layer1'], etc... );
        $array_layers_count = array_count_values($array_layers);
        if ($array_layers_count['yes']) {
            $results[$key]['Zombiesindexstats']['layers_count'] = $array_layers_count['yes'];
        } else {
            $results[$key]['Zombiesindexstats']['layers_count'] = 0;
        }

If there is no 'yes' index, i have always the warning 'Undefined index: yes in..' in logs. How to make it quiet ?