'How do I get sample values - Uncaught Error: Cannot use object of type stdClass as array

I print this array with var_export(), How do I get sample values of "id", "username", "password", "livello" etc

array (
  'iss' => 'miosito.com',
  'aud' => 'loginutente',
  'iat' => 1651245629,
  'nbf' => 1651245639,
  'exp' => 1651288829,
  'data' => 
  (object) array(
     'id' => '6',
     'username' => 'testuser',
     'password' => 'xxxxxxx',
     'livello' => '1',
  ),
)


Solution 1:[1]

You are accessing an object from within an array so $arr['data']->id

Solution 2:[2]

Since you converted the data array to an object, you can access the values like this

echo $array['data']->id;
echo $array['data']->username;
...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cmd3BOT
Solution 2 Guido Faecke