[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).
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