PHP Development 

Que: Write a function ReadXml($xmlstr) which accepts an XML

Problem Text :

Write a function ReadXml($xmlstr) which accepts an XML string as its only argument. Your function should write the names of the nodes and their values.

For Example :

ReadXml($xmlstr) where
$xmlstr= ‘<Address><to>James</to><from>Jani</from><heading>Reminder</heading><body>Please check your mail.</body></Address>’

should return

Address
to: James
from: Jani
heading: Reminder
body: Please check your mail.

Note: As the question requires the output to be displayed in the new/ next line, use “\n” instead of “<br>”

Please Share your Answer in Comment Box:

Want results like these for your business?

Talk to Aditya Infotech about SEO, Google Ads and websites that grow your business.

Get a free consultation

More from our blog