Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 11342

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Gets the name of the XML element</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="simplexmlelement.getdocnamespaces.html">SimpleXMLElement::getDocNamespaces</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="simplexmlelement.getnamespaces.html">SimpleXMLElement::getNamespaces</a></div>
 <div class="up"><a href="class.simplexmlelement.html">SimpleXMLElement</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="simplexmlelement.getname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SimpleXMLElement::getName</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.3)</p><p class="refpurpose"><span class="refname">SimpleXMLElement::getName</span> &mdash; <span class="dc-title">Gets the name of the XML element</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-simplexmlelement.getname-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>SimpleXMLElement::getName</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Gets the name of the XML element.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-simplexmlelement.getname-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The <em>getName</em> method returns as a <span class="type"><a href="language.types.string.html" class="type string">string</a></span> the 
   name of the XML tag referenced by the SimpleXMLElement object.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-simplexmlelement.getname-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     Listed examples may include <em>example.php</em>,
     which refers to the XML string found in the first example
     of the <a href="simplexml.examples-basic.html" class="link">basic usage</a> guide.
    </p>
   </p></blockquote>
   <div class="example" id="example-5508">
    <p><strong>Example #1 Get XML element names</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">'example.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sxe&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SimpleXMLElement</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlstr</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$sxe</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getName</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$sxe</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">children</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">$child</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$child</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getName</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
movies
movie
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="simplexmlelement.getdocnamespaces.html">SimpleXMLElement::getDocNamespaces</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="simplexmlelement.getnamespaces.html">SimpleXMLElement::getNamespaces</a></div>
 <div class="up"><a href="class.simplexmlelement.html">SimpleXMLElement</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>