How can I get the value from an array?

DarkLight's picture

He has: 287 posts

Joined: Oct 2007

Hi guys...
So I have a silly little problem, and I feel like, at my stage as a Dev, I should know to be common sense... But i'm stuck...

I have this array:

[0] => stdClass Object
(
[#text] => http://userserve-ak.last.fm/serve/34/49285167.jpg
[size] => small
)

But I don't know how to get the value for the "[#text]" key, as it has the hash symbol...
How do I get this value?

The array is returned as an object, from json.

Thanks in advance Smiling

All the best news here: https://newsbotnet.com

DarkLight's picture

He has: 287 posts

Joined: Oct 2007

Nevermind, I found out Smiling

$object->{'#text'}

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Glad you found it and thanks for coming back and updating the thread with the answer! Smiling

They have: 80 posts

Joined: Sep 2011

Good job.LOL

DarkLight's picture

He has: 287 posts

Joined: Oct 2007

Welcome, and Thanks Smiling Still think it's a strange way to build an array though...

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Just for clarification, that is an object, not an array.

-Greg

DarkLight's picture

He has: 287 posts

Joined: Oct 2007

Greg K wrote:
Just for clarification, that is an object, not an array.

-Greg

TRUE Laughing out loud I always call them arrays, but yeah I know you're right. Its just habit.

All the best news here: https://newsbotnet.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.