Zend
ZF-100-500 · Question #158
You have been given the following PHP script: 1. <?php 2. $xmlstring = <<<XML 3. <?xml version="1.0" encoding="ISO -8859-1"?> 4. <email> 7. <heading>Technical issue in Linux OS</heading> 8…
The correct answer is C. echo $child->getName() . ": " . $child . "<br />". See the full explanation below for the reasoning.
Question
You have been given the following PHP script: 1. <?php 2. $xmlstring = <<<XML 3. <?xml version="1.0" encoding="ISO -8859-1"?> 4. <email> 7. <heading>Technical issue in Linux OS</heading> 8. <body>There is a technical issue in my Linux system. Please Fix it. </body> 9. </email> 10. XML; 11. $xml = new SimpleXMLElement($xmlstring); 12. foreach($xml->children() as $child) 13. { Zend ZF-100-500 Exam 14. <Insert code here.> 15. } 16. ?> Which of the following code snippets will you insert at line number 14 to get the foll owing output?
Options
- Aecho $child->getNamespaces() . ": " . $child . "<br />";
- Becho $child->getDocNamespaces() . ": " . $child . "<br />";
- Cecho $child->getName() . ": " . $child . "<br />";
- Decho $child->asXML() . ": " . $child . "<br />";
How the community answered
(27 responses)- A11% (3)
- B4% (1)
- C81% (22)
- D4% (1)
Community Discussion
No community discussion yet for this question.