$xmlString = ''; $array = GeneralUtility::xml2array($xmlString); print_r($array); John 30 Jane 25
Array ( [root] => Array ( [item] => Array ( [0] => Array ( [name] => John [age] => 30 ) [1] => Array ( [name] => Jane [age] => 25 ) ) ) )
$xmlString = 'This will output the same result as Example 1. GeneralUtility is a part of the TYPO3 CMS core, and xml2array is a method defined in the utility class. Therefore, the package library is "typo3/cms-core".'; $xmlObj = new SimpleXMLElement($xmlString); $array = GeneralUtility::xml2array($xmlObj); print_r($array); John 30 Jane 25