Mam obiekt stdClass utworzony na podstawie json_decode, który nie zwróci właściwej liczby po uruchomieniu funkcji count ($ obj). Obiekt ma 30 właściwości, ale wartość zwracana przez funkcję count () to powiedzmy 1.
Jakieś pomysły?
Poniżej przykład jednego z obiektów. (Proszę o codzienne informacje o trendach z Twittera). Gdyby ten obiekt miał więcej niż jedną właściwość, liczba ($ obj) byłaby równa 1.
[trends] => stdClass Object
(
[2009-08-21 11:05] => Array
(
[0] => stdClass Object
(
[query] => "Follow Friday"
[name] => Follow Friday
)
[1] => stdClass Object
(
[query] => "Inglourious Basterds" OR "Inglorious Basterds"
[name] => Inglourious Basterds
)
[2] => stdClass Object
(
[query] => Inglourious
[name] => Inglourious
)
[3] => stdClass Object
(
[query] => #songsincode
[name] => #songsincode
)
[4] => stdClass Object
(
[query] => #shoutout
[name] => #shoutout
)
[5] => stdClass Object
(
[query] => "District 9"
[name] => District 9
)
[6] => stdClass Object
(
[query] => #howmanypeople
[name] => #howmanypeople
)
[7] => stdClass Object
(
[query] => Ashes OR #ashes
[name] => Ashes
)
[8] => stdClass Object
(
[query] => #youtubefail
[name] => #youtubefail
)
[9] => stdClass Object
(
[query] => TGIF
[name] => TGIF
)
[10] => stdClass Object
(
[query] => #wish09
[name] => #wish09
)
[11] => stdClass Object
(
[query] => #watch
[name] => #watch
)
[12] => stdClass Object
(
[query] => Avatar
[name] => Avatar
)
[13] => stdClass Object
(
[query] => Ramadhan
[name] => Ramadhan
)
[14] => stdClass Object
(
[query] => Goodnight
[name] => Goodnight
)
[15] => stdClass Object
(
[query] => iPhone
[name] => iPhone
)
[16] => stdClass Object
(
[query] => #iranelection
[name] => #iranelection
)
[17] => stdClass Object
(
[query] => Apple
[name] => Apple
)
[18] => stdClass Object
(
[query] => "Usain Bolt"
[name] => Usain Bolt
)
[19] => stdClass Object
(
[query] => H1N1
[name] => H1N1
)
)
)
2009-08-21 11:05
, jest tablicą z 20 pozycji, więc liczyć ($ trendy) byłoby słusznie zwraca 1.