Page 1 of 1

Printing out an element of stdClass Object

Posted: Tue Aug 19, 2008 2:12 pm
by cparekh
Hi,

a bit of a n00bie question here: I'm trying to print out an element of an array and I'm having trouble accessing it.

I'm querying a table using JFACTORY::getDBO() and a print_r of the result returns this:

Code: Select all

Array ( [0] => stdClass Object ( [title] => Infrastructure ) )
And what I'd like to do is print out 'Infrastructure'. What can I use to access it?

Thanks in advance for your help,
C.

Re: Printing out an element of stdClass Object

Posted: Tue Aug 19, 2008 6:53 pm
by ircmaxell
echo $var[0]->title;

Re: Printing out an element of stdClass Object

Posted: Wed Aug 20, 2008 7:44 am
by cparekh
ircmaxell,

Thanx, that did it! :)