I have an array (paint) where the output looks like this:
array(3) {
["id"]=> string(1) "2"
["type"]=> string(1) "O"
["number"]=> string(1) "1"
}
array(3) {
["id"]=> string(1) "3"
["type"]=> string(1) "W"
["number"]=> string(1) "3"
}
array(3) {
["id"]=> string(1) "4"
["type"]=> string(1) "W"
["number"]=> string(1) "5"
}
Etc.
What I am trying is how often the type field contains W. So in this case I should have an output of 2. He should skip the first because there the type field is O.
What I tried:
$sum = count($paint["type=W"]);
That doesn't work though. Is it possible to just count how often the type value is W?
$sum = count($paint["type=W"]);maybe a little typo just insert the ]array_columnandarray_count_valuesto get desired result.