note 102277 modified in function.simplexml-load-string by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
A simpler way to transform the result into an array (requires json module).

<?php
function object2array($object) { return @json_decode(@json_encode($object),1); }
?>

Example:
<?php
$xml_object=simplexml_load_string('<SOME XML DATA');
$xml_array=object2array($xml_object);
?>

--was--
A simpler way to transform the result into an array (requires json module).

function object2array($object) { return @json_decode(@json_encode($object),1); }

Example:
$xml_object=simplexml_load_string('<SOME XML DATA');
$xml_array=object2array($xml_object);

http://php.net/manual/en/function.simplexml-load-string.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.