<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Get the value of a named attribute</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xmlreader.expand.html">XMLReader::expand</a></div> <div class="next" style="text-align: right; float: right;"><a href="xmlreader.getattributeno.html">XMLReader::getAttributeNo</a></div> <div class="up"><a href="class.xmlreader.html">XMLReader</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="xmlreader.getattribute" class="refentry"> <div class="refnamediv"> <h1 class="refname">XMLReader::getAttribute</h1> <p class="verinfo">(PHP 5 >= 5.1.0)</p><p class="refpurpose"><span class="refname">XMLReader::getAttribute</span> — <span class="dc-title">Get the value of a named attribute</span></p> </div> <div class="refsect1 description" id="refsect1-xmlreader.getattribute-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>XMLReader::getAttribute</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span> )</div> <p class="para rdfs-comment"> Returns the value of a named attribute or <strong><code>NULL</code></strong> if the attribute does not exist or not positioned on an element node. </p> </div> <div class="refsect1 parameters" id="refsect1-xmlreader.getattribute-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">name</code></em></span> <dd> <p class="para"> The name of the attribute. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-xmlreader.getattribute-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The value of the attribute, or <strong><code>NULL</code></strong> if no attribute with the given <em><code class="parameter">name</code></em> is found or not positioned on an element node. </p> </div> <div class="refsect1 changelog" id="refsect1-xmlreader.getattribute-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.1.3</td> <td> Return <strong><code>NULL</code></strong> if no attribute found. Previously, returned an empty string. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-xmlreader.getattribute-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="xmlreader.getattributeno.html" class="methodname" rel="rdfs-seeAlso">XMLReader::getAttributeNo()</a> - Get the value of an attribute by index</span></li> <li class="member"> <span class="methodname"><a href="xmlreader.getattributens.html" class="methodname" rel="rdfs-seeAlso">XMLReader::getAttributeNs()</a> - Get the value of an attribute by localname and URI</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xmlreader.expand.html">XMLReader::expand</a></div> <div class="next" style="text-align: right; float: right;"><a href="xmlreader.getattributeno.html">XMLReader::getAttributeNo</a></div> <div class="up"><a href="class.xmlreader.html">XMLReader</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>