PHP getName() Function
PHP SimpleXML Reference Manual
Example
Return the names of an XML element and its child elements:
XML;
$sxe=new SimpleXMLElement($xml);
echo $sxe->getName() . "
";
foreach ($sxe->children() as $child)
{
echo $child->getName() . "
";
}
?>
Run Example »
Definition and Usage
The getName() function returns the name of an XML element.
Syntax
getName();
Technical Details
| Return Value: | Returns the name of the XML tag referenced by the SimpleXML element, as a string. |
|---|---|
| PHP Version: | 5.1.3+ |
PHP SimpleXML Reference Manual