- print_r: documentation ( source)
- dom_import_simplexml: documentation ( source)
- iterator_to_array: documentation ( source)
<?php
$sxe = new SimpleXMLElement('<people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test"/>');
$xpath = new DOMXPath(($doc = dom_import_simplexml($sxe)->ownerDocument));
print_r(iterator_to_array($xpath->evaluate('/*/namespace::*')));