I need to count the times a key/variable is shown inside an array of arrays.
The array looks like this:
Array
{
[3] => Array
{
[type]=>group
[name]=>3st group
[newmsgs]=>3
}
[2] => Array
{
[type]=>group
[name]=>2nd group
}
[1] => Array
{
[type]=>group
[name]=>1st group
[newmsgs]=>1
}
}
I am looking for a function that runs and returns 2 since there are only 2 arrays that have the 'newmsgs' key with value.
I've tried array_count_values() without success, as well as trying a simple count() which I knew has a slim chance of working.
Any idea of how to do this?