Jackson Jackson - 7 months ago 13
SQL Question

PHP: Get string from within Array?

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.

Answer

As stated in my comment, simply change:

$age_range = $me['age_range'];

to

$age_range = $me['age_range']['min'];