-1

I've got an array which outputs:

stdClass Object ( [firstName] => Rupert [headline] => Managing Director at 
READ Advisors [lastName] => Bowen-Jones [pictureUrl] => 
https://media.licdn.com/mpr/mprx/0_yrLwHnXDTWGSypSo-
B_NHz9hiu52pMpoOAAqHzLxpolpijIEr9zbQvllDTL1xYj6g1FvFtBsywhL ) 

And I'm trying to pick out each item:

foreach ($user_data as $key => $value) {
echo "<br />" . $value['firstName'] . "<br />";
}

But I'm getting the following errors:

stdClass Object ( [firstName] => Rupert [headline] => Managing Director at 
READ Advisors [lastName] => Bowen-Jones [pictureUrl] => 
https://media.licdn.com/mpr/mprx/0_yrLwHnXDTWGSypSo-
B_NHz9hiu52pMpoOAAqHzLxpolpijIEr9zbQvllDTL1xYj6g1FvFtBsywhL ) 
Warning: Illegal string offset 'firstName' in 
/home/readadvisors/readadvisors.com/auth/linkedin/callback.php on line 26

R

Warning: Illegal string offset 'firstName' in
/home/readadvisors/readadvisors.com/auth/linkedin/callback.php on line 26
M

Warning: Illegal string offset 'firstName' in 
/home/readadvisors/readadvisors.com/auth/linkedin/callback.php on line 26

B

Warning: Illegal string offset 'firstName' in
/home/readadvisors/readadvisors.com/auth/linkedin/callback.php on line 26
h

Your help would be much appreciated!! Rupert

mrks
  • 43
  • 3
rupertbj
  • 73
  • 12

1 Answers1

1

Assuming $user_data is an array of objects

foreach ($user_data as $key => $value) {
echo "<br />" . $value->firstName . "<br />";
}
MANO
  • 183
  • 1
  • 7