getName ()

Gets the name of the XML element.

Access

public

Returns

Type

Description

string

The getName method returns as a string the name of the XML tag referenced by the SimpleXMLElement object.

Examples

Get XML element names

include 'example.php';
$sxe = new SimpleXMLElement($xmlstr);

echo $sxe->getName() . "\n";

foreach ($sxe->children() as $child)
{
    echo $child->getName() . "\n";
}
Result:
movies
movie

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback