views:

53

answers:

4

Hi,

This is a newbie question - how do I access the value0, value1, ... entities?

         object(SimpleXMLElement)#43 (2) {
            ["@attributes"]=>
            array(3) {
              ["ABC"]=>
              string(1) "1"
              ["DEF"]=>
              string(14) "recordXYZ"
              ["GHI"]=>
              string(1) "@"
            }
            ["qwerty"]=>
            array(5) {
              [0]=>
              string(4) "value0"
              [1]=>
              string(1) "value1"
              [2]=>
              string(2) "value2"
              [3]=>
              string(2) "value3"
              [4]=>
              string(4) "value4"
            }
          }
+2  A: 

When $object is the SimpleXMLElement object you showed, then $object->qwerty is the array with your values.

Gumbo
A: 
foreach ($object->querty as $val) {
    var_dump($val);
}
Michiel
A: 

See the children() function in the SimpleXMLElement documentation for an example.

Dolph
+2  A: 

Just plain array access

$value0 = $object->qwerty[0]
$value1 = $object->qwerty[1]
Yada