1 2 3 4 5 6 7
<?php $xmlstring = "<parent><child> hello world </child></parent>"; $xml = simplexml_load_string($xmlstring); $foo = array( (string) $xml->child ); var_dump($xml).PHP_EOL; var_dump($foo); ?>
1 2 3 4 5 6 7 8
object(SimpleXMLElement)#1 (1) { ["child"]=> string(13) " hello world " } array(1) { [0]=> string(13) " hello world " }