So i've been trying to count this object array for ages, and nothing seem to work for me...
stdClass Object
(
[type] => champion
[version] => 5.24.2
[data] => stdClass Object
(
[Thresh] => stdClass Object
(
[id] => 412
[key] => Thresh
[name] => Thresh
[title] => the Chain Warden
[info] => stdClass Object
(
[attack] => 5
[defense] => 6
[magic] => 6
[difficulty] => 7
)
)
[Aatrox] => stdClass Object
(
[id] => 266
[key] => Aatrox
[name] => Aatrox
[title] => the Darkin Blade
[info] => stdClass Object
(
[attack] => 8
[defense] => 4
[magic] => 3
[difficulty] => 4
)
)
[Tryndamere] => stdClass Object
(
[id] => 23
[key] => Tryndamere
[name] => Tryndamere
[title] => the Barbarian King
[info] => stdClass Object
(
[attack] => 10
[defense] => 5
[magic] => 2
[difficulty] => 5
)
)
[Ezreal] => stdClass Object
(
[id] => 81
[key] => Ezreal
[name] => Ezreal
[title] => the Prodigal Explorer
[info] => stdClass Object
(
[attack] => 7
[defense] => 2
[magic] => 6
[difficulty] => 7
)
)
)
)
What i want to count is the length of data
.
Plot Twist: count($array->data)
doesn't work.
If it counts right, it should return 3. Thank you in advance!