NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Examining Objects


Joined: 16 Apr 2008
Posts: 40
Reply with quote
I'm still very much a newbie when it comes to using objects in PHP.

I'm using Curl to capture a page then assigning it to a DOM object:-

Code:
$objHTMLPage1 = new DOMDocument();
@$objDom->loadHTML($objHTMLPage1 )


Can I examine the contents of $objDom in PhpED. If so how do I do it?

TIA
View user's profileFind all posts by southcotSend private message
Veteran

Joined: 30 Aug 2006
Posts: 116
Reply with quote
First, I'd suggest avoiding using @ to suppress messages, it is a bad habit and has cost me alot of time in the past.

Second you can use print_r() to echo out the object, or (better yet) use PHPEd's excellent debugger to inspect the object while debugging the script.
View user's profileFind all posts by rudderSend private message


Joined: 16 Apr 2008
Posts: 40
Reply with quote
Thanks for the response. Actually using the @ syntax is not normally something I do I'm just using some example code. I was perhaps less than specific, I am using the debugger but I don't seem to be able to see anyway of examining the object in it.
View user's profileFind all posts by southcotSend private message
Veteran

Joined: 30 Aug 2006
Posts: 116
Reply with quote
If you're already in debug mode, after the debugger has run past the code that would populate your object, mouse over it. You can also look for a tab called "Watch" and add the variable into the watchlist (works good for large objects or arrays)
View user's profileFind all posts by rudderSend private message


Joined: 16 Apr 2008
Posts: 40
Reply with quote
That's what I was expecting to happen but no; if I add $objHTMLPage1 to the watch window it changes from null as the program passes the line:-

Code:
$objHTMLPage1 = new DOMDocument();


However it shows no content in the value column and just Object(DOMDocument) in the type column.

The code executes fine however.
View user's profileFind all posts by southcotSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
You can't see the contents of those kind of objects, there internally to PHP. You can run any code on them you want by just typing them in the immediate window while the debugger is paused Smile I often use this to check or change objects.
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 16 Apr 2008
Posts: 40
Reply with quote
Blizz wrote:
You can't see the contents of those kind of objects, there internally to PHP. You can run any code on them you want by just typing them in the immediate window while the debugger is paused Smile I often use this to check or change objects.


Thanks
View user's profileFind all posts by southcotSend private message
Examining Objects
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic