nerdexam
Zend

200-530 · Question #472

What is the work of simplexml_import_dom() in the following PHP code? <?php $dom = new domDocument; $dom->loadXML('<email><from>John</from></email>'); $xml = simplexml_import_dom($dom); echo…

The correct answer is D. It gets a SimpleXMLElement object from a DOM node. See the full explanation below for the reasoning.

Question

What is the work of simplexml_import_dom() in the following PHP code? <?php $dom = new domDocument; $dom->loadXML('<email><from>John</from></email>'); $xml = simplexml_import_dom($dom); echo $xml->from; ?>

Options

  • AIt gets the name of a SimpleXML element.
  • BIt gets the namespaces from XML data.
  • CIt gets a SimpleXMLElement object from an XML document.
  • DIt gets a SimpleXMLElement object from a DOM node

How the community answered

(17 responses)
  • A
    6% (1)
  • B
    6% (1)
  • C
    18% (3)
  • D
    71% (12)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice