Open In App

PHP | XMLReader getAttributeNs() Function

The XMLReader::getAttributeNs() function is an inbuilt function in PHP which is used to get the value of an attribute by name and namespace URI or an empty string if attribute does not exist or not positioned on an element node.

Syntax:



string XMLReader::getAttributeNs( string $localName, 
                               string $namespaceURI )

Parameters: This function accept two parameters as mentioned above and described below:

Return Value: This function returns the value of attribute on success or empty string on failure.



Below examples illustrate the XMLReader::getAttributeNs() function in PHP:

Example 1:

Example 2:

Reference: https://www.php.net/manual/en/xmlreader.getattributens.php


Article Tags :