Calculate the value in the position and add up?

I use the database interaction between curl and my counterpart
to give me array
where a bit value called available, is a Boolean value
the counterpart gives me 10 years
in which 4 available is ture
how can I figure out "4" at this point?

foreach ($anget_my_people_data->{"users"} as $key) {

    echo $key->{"available"};
}
Mar.12,2021

like this?

$i = 0;
foreach ($anget_my_people_data->{'users'} as $key) {
    if ( $key->{'available'} ===TRUE){
        $iPP;
    }
}
return $i;
Menu