Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $xmlData = "<?xml version='1.0'?>
- <methodResponse>
- <params>
- <param>
- <value><array><data>
- <value><struct>
- <member>
- <name>description</name>
- <value><string></string></value>
- </member>
- </struct></value>
- </data></array></value>
- </param>
- </params>
- </methodResponse>";
- $plainParsed = simplexml_load_string($xmlData);
- $NoNewLineParsed = simplexml_load_string(str_replace(array("\n", "\r"), '', $xmlData));
- $testArray = array($plainParsed, $NoNewLineParsed);
- foreach ($testArray as $test) {
- var_dump(
- $test->params->param->value->array->data->value->struct->member->value
- );
- }
- //first pass (new lines not removed) returns array
- //second pass (new lines removed) returns element
Advertisement
Add Comment
Please, Sign In to add comment