Re: print_r() and SimpleXML
| From: | Paul Reinheimer | Date: | Thu, 02 Dec 2004 20:40:26 +0000 |
| Subject: | Re: print_r() and SimpleXML | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203383@lists.php.net to get a copy of this message | ||
Thanks a lot, I read the SimpleXML page a lot, but didn't drop into
the ->attributes page itself.
again, thanks
paul.
On Tue, 30 Nov 2004 23:34:14 -0800, Rick Fletcher <fletch@pobox.com> wrote:
> [snip]
> > when using print_r on a SimpleXML object that has
> > attributes, the attributes are not shown.
> >
> > I would propose that this is not the desired response. When using
> > print_r on an object, it should display all available information
> > (even, as the manual indicates, private and/or protected properties).
> [snip]
> > Now, if people agree with me, that this is infact not the desired
> > response. Is this a 'bug' with SimpleXML or print_r?
>
> On the SimpleXML->attributes documentation page
> (http://www.php.net/manual/en/function.simplexml-element-attributes.php)
> you'll find this note:
>
> "SimpleXML has made a rule of adding iterative properties to most
> methods. They cannot be viewed using var_dump() or anything else which
> can examine objects."
>
> A pain? Maybe. A bug? No.
>
> There are a couple of user functions in the SimpleXML documentation
> comments that will convert a SimpleXML object to an array. You can then
> pass that array to print_r for debugging.
>
> Find the code here:
> http://www.php.net/manual/en/ref.simplexml.php
>
> Cheers,
> Rick
>
>
--
Paul Reinheimer
Zend Certified Engineer