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.
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 1 of 1 people found this answer helpful. Did you? Yes No i think it will good work, thank you :) ok i hope you can use it correctly |
© Advanced Web Core. All rights reserved