Re: print_r() and SimpleXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux