<!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>The DOMNodeList class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="domnode.replacechild.html">DOMNode::replaceChild</a></div> <div class="next" style="text-align: right; float: right;"><a href="domnodelist.count.html">DOMNodeList::count</a></div> <div class="up"><a href="book.dom.html">DOM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.domnodelist" class="reference"> <h1 class="title">The DOMNodeList class</h1> <div class="partintro"><p class="verinfo">(PHP 5, PHP 7)</p> <div class="section" id="domnodelist.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">DOMNodeList</strong> </span> <span class="oointerface">implements <span class="interfacename"><a href="class.traversable.html" class="interfacename">Traversable</a></span> </span> <span class="oointerface">, <span class="interfacename"><a href="class.countable.html" class="interfacename">Countable</a></span> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div> <div class="fieldsynopsis"> <span class="modifier">readonly</span> <span class="modifier">public</span> <span class="type">int</span> <var class="varname"><a href="class.domnodelist.html#domnodelist.props.length">$<var class="varname">length</var></a></var> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="domnodelist.count.html" class="methodname">count</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="type">DOMNode</span> <span class="methodname"><a href="domnodelist.item.html" class="methodname">item</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span> )</div> }</div> </div> <div class="section" id="domnodelist.props"> <h2 class="title">Properties</h2> <dl> <dt id="domnodelist.props.length"><var class="varname"><var class="varname">length</var></var></dt> <dd> <p class="para"> The number of nodes in the list. The range of valid child node indices is 0 to <em>length - 1</em> inclusive. </p> </dd> </dl> </div> <div class="section" id="domnodelist.changelog"> <h2 class="title">Changelog</h2> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>7.2.0</td> <td> The <a href="class.countable.html" class="classname">Countable</a> interface is implemented and returns the value of the <a href="class.domnodelist.html#domnodelist.props.length" class="link">length</a> property. </td> </tr> </tbody> </table> </p> </div> <div class="section"> <h2 class="title">See Also</h2> <p class="para"> <ul class="simplelist"> <li class="member"><a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-536297177" class="link external">» W3C specification of NodeList</a></li> </ul> </p> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="domnodelist.count.html">DOMNodeList::count</a> — Get number of nodes in the list</li><li><a href="domnodelist.item.html">DOMNodeList::item</a> — Retrieves a node specified by index</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="domnode.replacechild.html">DOMNode::replaceChild</a></div> <div class="next" style="text-align: right; float: right;"><a href="domnodelist.count.html">DOMNodeList::count</a></div> <div class="up"><a href="book.dom.html">DOM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>