<?xml version=’1.0′?

The XML document below has been parsed into $xml via SimpleXML. How can the value of <foo> tag accessed?

<?xml version=’1.0′?>

<document>

<bar>

<foo>Value</foo>

</bar>

</document>
A . $xml->bar[‘foo’]
B . $xml->bar->foo
C . $xml[‘document’][‘bar’][‘foo’]
D . $xml->document->bar->foo
E . $xml->getElementByName(‘foo’);

Answer: B

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments