demo_func_simplexml_getnamespaces.php:
<!DOCTYPE html> <html> <body> <?php $xml=<<<XML <?xml version="1.0" standalone="yes"?> <cars xmlns:c="https://begtut.com/ns" xmlns:a="https://begtut.com/country"> <c:car id="1">Volvo</c:car> <c:car id="2">BMW</c:car> <c:car id="3">Saab</c:car> </cars> XML; $sxe=new SimpleXMLElement($xml); $ns=$sxe->getNamespaces(true); var_dump($ns); ?> </body> </html>