I'm developing a plugin which does API calls. As a result I'm filling an array with boolean values for success and false.
When my calls are done (multiple calls possible), I want to output a message how many calls were successful and how many failed. This sounds like a simple task, but I have no idea how to do a simple counting.
I've found this question here which fits the most but still misses the false counting part:
PHP Count Number of True Values in a Boolean Array
Do you have any idea how I can get this done a simple way?
This is an example array:
$result = [
true,
false,
false,
true,
true,
true
];
$successful_calls_count = count($result)....
$failed_calls_count = count($result)....