Re: [PHP-XML-DEV] SimpleXML behaves like chameleon

[email protected] (Christian Stocker) Mon, 31 Jan 2005 22:59:08 +0100
Newsgroups php.xml.dev
Message-ID <[email protected]>

On 31.1.2005 22:46 Uhr, Jirka Kosek wrote:
> Christian Stocker wrote:
> 
>> Simple answer, the usual array functions don't work on simplexml 
>> objects. Use the iterator interface.
> 
> 
> OK, I can uderstand to this. But it still unclear to me why some 
> properties of objects returned by SimpleXML are one time typed as array 
> and second time as an object. Maybe it is because SimpleXML tries to 
> make things simpler than they are ;)

You can't rely on print_r. It's of no value, what that says, so don't 
try to interpret that ;) (the same goes for var_dump, btw). The iterator 
interface (foreach et al.) will do the correct thing for you.

> BTW: Do you have idea when PHP 5.1 will be out (even on RC level)? Many 
> XML things (like namespace bindings and XPath issues) should be fixed in 
> this release.

No, no idea.

chregu
> 
>                 Jirka
> 

-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [email protected]  |  gnupg-keyid 0x5CE1DECB