Tag Archives: converting SimpleXMLElement Object to array using php

How to fetch MydataID from the following xml format

This format of xml is obtained from a soapcall using curl function. below $xml data is the respponse $xml=’mydoubts.in434535345435435435435435-mydoubts.inmydoubts.in0true‘; $response1 = str_replace(““,””,$xml); $response2 = str_replace(““,””,$response1); $parser = simplexml_load_string($response2); $t= $parser->Hellomydata->Mydoubtresult->MydataID; echo $t[0]; it will show the ouput as-> 434535345435435435435435-mydoubts.in