I have an object contained inside an array
array(1) {
["main"]=> object(Profile)#151 (20)
{
["field_first_name"]=> array(1) { ["und"]=> array(1) { [0]=> array(3) { ["value"]=> string(6) "Fred" ["format"]=> NULL ["safe_value"]=> string(6) "Fred" } } }
}
}
I am trying to get the value "Fred" from this array. I thought I could do this
$first_name= $profile['main']->['field_first_name']['und'][0]['value'];
but it didn't work. It actually gave me an error
Parse error: syntax error, unexpected '[', expecting T_STRING or T_VARIABLE or '{' or '$'
What am I doing wrong?