Answers for "php get api xml to array"

PHP
4

php xml to array

public function xmlToArray($xmlstring){
    
  $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
  $json = json_encode($xml);
  $array = json_decode($json,TRUE);

  return $array;

}
Posted by: Guest on August-25-2020

Browse Popular Code Answers by Language