getNamespace()

It returns the namespaces from XML data

Example

<?php
$xml = simplexml_load_file(‘test.xml’);
echo “<pre>”;

print_r($xml->getNamespace());

?>

Output

Array
(
[b] => http://www.phpcodez.come/
)

XML

<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<web xmlns:b=”http://www.phpcodez.com/”>
<server ver=”5″>Apache</server>
<lan>PHP</lan>
<client>Javascript</client>
</web>