? Phpxmlstring $ xml_stringquot ;? Xmlversion #39; 1.0 #39; nbsp...
Foo
Foo@bar.com
Foobar
Foobar@foo.com
"; // Load the xml string using simplexml $ xml = simplexml_load_string ($ xml_string); // loop through the each node of user foreach ($ xml-> user as $ user) {// access attribute echo $ user ['id'], ''; // subnodes are accessed by-> operator echo $ user-> name ,''; echo $ user-> email ,'
';} Json data parsing code: $ json_string =' {"id": 1, "name": "foo", "email": "foo@foobar.com", "interest ": ["wordpress", "php"]} '; $ obj = json_decode ($ json_string); echo $ obj-> name; // prints foo echo $ obj-> interest [1]; // prints php // xml string $ xml_string ="
Foo
Foo@bar.com
Foobar
Foobar@foo.com
"; // Load the xml string using simplexml $ xml = simplexml_load_string ($ xml_string); // loop through the each node of user foreach ($ xml-> user as $ user) {// access attribute echo $ user ['id'], ''; // subnodes are accessed by-> operator echo $ user-> name ,''; echo $ user-> email ,'
';}?>
Php also comes with a php xml Parser
Introduction to php xml Parser
XML functions allow us to parse XML documents, but cannot verify them. XML is a data format used for standard Structured document exchange.