Reply
Getting result from object array
Old 05-20-2008, 09:23 AM Getting result from object array
scrobins's Avatar
Experienced Talker

Posts: 46
Name: Stuart Robinson
Location: Busselton
Please excuse my ignorance - I haven't quite got a handle on objects yet. I'm trying to source the website from this array I drew out of some class code.

I performed the following;

PHP Code:
var_dump($this->items); 
which resulted in this;

array(248) {
[0]=>
object(SimplePie_Item)#79 (2) {
["feed"]=>
object(PlanetPerson)#6 (47) {
["name"]=>
string(27) "Example Blog"
["feed"]=>
string(82) "http://example.com/rss.xml"
["website"]=>
string(107) "http://example.com/"
["data"]=>
array(6) {
["child"]=>.....etc

then, I set up the loop to go through the array as follows;

PHP Code:
foreach ($all_items as $item
and now I want to try and retrieve the website address. So, if someone can help me
with the syntax for doing that it would certainly be helpful.

I've tried the following;

$item["website'];

and got the error;

Fatal error: Cannot use object of type SimplePie_Item as array in....

and also tried;

$item->website;

which returned;

Notice: Undefined property: SimplePie_Item::$website in...
scrobins is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-21-2008, 08:46 AM Re: Getting result from object array
evilhuman's Avatar
Junior Talker

Posts: 3
Name: Tom
From your var_dump it looks as though you have an object within an object... an object of type PlanetPerson inside the object of type SimplePie_Item, with the property name of "feed".

Does $item->feed->website work any better?
evilhuman is offline
Reply With Quote
View Public Profile Visit evilhuman's homepage!
 
Reply     « Reply to Getting result from object array
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15069 seconds with 12 queries