0

I'm using facebook SDK and I'm trying to get a string from an array which is the facebook php sdk response.

Basically, I get the age_range from facebook and I need to get the value of age_range.

The age range always is an array for some strange reason.

It looks like this:

[age_range] => Array
    (
        [min] => 21
    )

so, in my php I have this:

$age_range = $me['age_range'];

but when i insert this $age_range into mysql database, I get the word Array inserted into mysql database!

But all i need is the 21 or any other number that returns back from age range.

could someone please advise on this issue?

Thanks in advance.

3
  • 2
    Does $age_range = $me['age_range']['min']; work? Commented May 1, 2016 at 12:40
  • No problem, glad I could help. When you get a minute if you could click the tick to the left of my answer that would be great :) Commented May 1, 2016 at 12:48
  • @MattKent, Will do bud... its saying i need to wait 3 minutes before accepting it. Commented May 1, 2016 at 12:49

1 Answer 1

3

As stated in my comment, simply change:

$age_range = $me['age_range'];

to

$age_range = $me['age_range']['min'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.