-2

I have the following array printed out with var_dump($myArray):

array(2) { 
    [0]=> object(stdClass)#2 (4) { 
        ["date"]=> string(25) "2015-07-17T05:31:49+02:00" 
        ["author"]=> string(2) "Me" 
        ["subject"]=> string(9) "MySubject" 
        ["message"]=> string(19) "This is my message."
     } 
     ["message"]=> string(4) "test" 
 }

I want to print out only the subject. I tried

echo $myArray[0]["subject"];

but I get an empty site. Thanks for your help.

IceCoala
  • 45
  • 7

1 Answers1

1

As your dump explained ... its an object

so you can access it via echo $myArray[0]->subject;

donald123
  • 5,638
  • 3
  • 26
  • 23