Aswad Shaik Aswad Shaik - 4 months ago 15
PHP Question

how to get single value from stdClass Object (access_token)

stdClass Object
(
[access_token] => EAAYX7VzZCIcABAGCnZADQJZBhXvaJ5eIJ34mNyIKLnFpbInEEZBJJJjjYunzsIBidrZARbZCUr68L66RVoiIgkcj9NW4Ssl1X7
[token_type] => bearer
[expires_in] => 5162059
)


I want to get output access_token ->
EAAYX7VzZCIcABAGCnZADQJZBhXvaJ5eIJ34mNyIKLnFpbInEEZBJJJjjYunzsIBidrZARbZCUr68L66RVoiIgkcj9NW4Ssl1X7


thanks in advance

Answer Source

You can do: $obj->access_token

Or you can turn it into an array:

$array = get_object_vars($obj);