Have an account? Sign in
Login  Register  Facebook
what is the best PHP xml2array function
I need a function that takes a string as XML input and change that into an array. Example:
<a>
 <b>
  <c></c>
 </b>
</a>
So I can read it in PHP like this:
$array = xml2array($xmlcode);
echo $array['a']['b']['c'];
Note: I tried all xml2array functions in PHP's documentation on xml_parse, and they all didn't work or had problems.
Started: September 17, 2011 Latest Activity: September 17, 2011 php xml function
1 Answer
You can do something very similar ($xml->a->b->c) with SimpleXML.
See the basic usage examples.
echo $xml->entry[0]->details;
or, for every entry:
foreach ($xml as $entry) {
    echo $entry->details;
}

Posted: MacOS
In: September 17, 2011

i think it will good work, thank you :)
September 17, 2011

ok i hope you can use it correctly
September 17, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer