[Solved] How to read google returned data object in PHP [closed]


If you have an object like this. Follow this example:

// THIS IS A SAMPLE, JUST TO SIMULATE how to access values inside
class Google_Service_Oauth2_Userinfoplus {
    public $email="[email protected]";
    public $familyName="Janorkar";
    public $gender = null;
    public $givenName="Mona";
    public $hd = null;
    public $id = '11018813453254107047543';
    public $name="Mona Janorkar";
    public $verifiedEmail = 1;
    protected $data = array(
        'verified_email' => 1,
        'given_name' => 'Mona',
        'family_name' => 'Janorkar',

    );
    protected $processed = array();
}

// for example! this is the returned object
$object = new Google_Service_Oauth2_Userinfoplus();

// you can access the properties of the object thru the "->"
echo $object->email; // [email protected]

Supplemental Info: This topic is also tackled here

What is the “->” PHP operator called and how do you say it when reading code out loud?

Where do we use the object operator “->” in PHP?

solved How to read google returned data object in PHP [closed]