Hi,
So, if I have an object of the form:
stdClass Object
(
[1909] => 1
[1950] => 1
[1977] => 1
[1982] => 2
[1984] => 1
[1986] => 1
....
How do I get a list of the data member names (like "1909, 1950, etc"). Note , they may be dates here, but are ARBITRARY. completely.
I ask because I have this JSON feed:
{"1909":1,"1950":1,"1977":1,"1982":2,"1984":1,"1986":1,"19....
But I only care about the strings, not the numbers they map to.
I don't want to hack this together by parsing the JSON string myself (because input is arbitrary, and this script needs to be neat, and I don't want to reinvent the wheel).
Thank you kindly for help.
-alex
Retrieving data member names from a PHP Object
Moderator: General Moderators
-
kuksenkate
- Forum Newbie
- Posts: 5
- Joined: Mon Jun 01, 2009 12:44 pm
Re: Retrieving data member names from a PHP Object
I bet there's a function to get class vars somewhere.
-
kuksenkate
- Forum Newbie
- Posts: 5
- Joined: Mon Jun 01, 2009 12:44 pm
Re: Retrieving data member names from a PHP Object
thanks - exactly what i was looking for.