I'm a complete newbie at php, but anyway, here it goes:
I want to count the amount of ["completed"]=> bool(true) in the array below.
I was able to count the total by doing this: $totalCount = count($object->data);. Do I need to do a foreach() in order to get the amount of completed ones or can I get around it by just doing some kind of count()?
Thanks!
object(stdClass)#2 (1) {
["data"]=>
array(232) {
[0]=>
object(stdClass)#3 (2) {
["id"]=>
int(13081073106396)
["completed"]=>
bool(true)
}
[1]=>
object(stdClass)#4 (2) {
["id"]=>
int(13160080793822)
["completed"]=>
bool(false)
}
->operator, so it is$obj->dataand not$obj['data']because you are dealing with objects and not arrays.