简体   繁体   中英

How get a detail of an array result

I don't know how to do this in PHP so I i'll ask it here. Right now I have this:

$s3 = $sdk->getUser();
var_dump($s3["custom_fields"]);

It results in:

string(51) "a:1:{s:3:"IGN";s:27:"hfsdkklsdhfasfhoihgoiahgoid";}"

The only thing I want is: hfsdkklsdhfasfhoihgoiahgoid

How can I get that?

it's a serialized array.

var_dump(unserialize($s3["custom_fields"]));

there ya go.

You can do it this way:

$s3 = $sdk->getUser();
$custom_fields = unserialize($s3["custom_fields"]);

echo $custom_fields['IGN'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM