fazlurr
7/13/2016 - 1:50 AM

Convert XML Object into PHP Array - http://stackoverflow.com/a/6167346/1703124

Convert XML Object into PHP Array - http://stackoverflow.com/a/6167346/1703124

<?php
$xml = json_decode(json_encode((array) simplexml_load_string($string)), 1);
<?php
function xml2array ( $xmlObject, $out = array () )
{
  foreach ( (array) $xmlObject as $index => $node )
    $out[$index] = ( is_object ( $node ) ) ? xml2array ( $node ) : $node;

  return $out;
}
?>