Jump to content

simplexml object problem


clandmeter

Recommended Posts

Hi,

 

Im using simplexml, i want to fetch a value from an array inside an object.

 

Normaly i would do this to get value2:

 

echo $xml->item1->item3[item4];

 

But now i have to do:

 

echo $xml->item.1->item3[item4];

 

But the dot in item.1 will give me an error.

What would be the correct line to get value2?

 

 

SimpleXMLElement Object
(
    [item.1] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [item2] => value1
                )

            [item3] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [item4] => value2
                            [item5] => value3
                            [item6] => value4
                            [item7] => value5
                            [item8] => value6
                            [item9] => value7
                        )

                )

        )

)

 

 

Thx,

 

Carlo

Link to comment
https://forums.phpfreaks.com/topic/48920-simplexml-object-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.