views:

28

answers:

1

I have this serialized array but I have no idea how to get the id: 7796249@N02

a:2:{s:4:"user";a:3:{s:2:"id";s:11:"7796249@N02";s:4:"nsid";s:11:"7796249@N02";s:8:"username";a:1:{s:8:"_content";s:9:"ilhan.z.y";}}s:4:"stat";s:2:"ok";}


$array = unserialize('a:2:{s:4:"user";a:3:{s:2:"id";s:11:"7796249@N02";s:4:"nsid";s:11:"7796249@N02";s:8:"username";a:1:{s:8:"_content";s:9:"ilhan.z.y";}}s:4:"stat";s:2:"ok";}');
+2  A: 

Here's where the id is:

$array['user']['id'];

Next time, use print_r() or var_dump():

echo '<pre>';
print_r($array);
var_dump($array);
echo '</pre>';

to see a human-readable representation of the array.

NullUserException