<!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 RecursiveTreeIterator class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="recursiveregexiterator.haschildren.html">RecursiveRegexIterator::hasChildren</a></div> <div class="next" style="text-align: right; float: right;"><a href="recursivetreeiterator.beginchildren.html">RecursiveTreeIterator::beginChildren</a></div> <div class="up"><a href="spl.iterators.html">Iterators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.recursivetreeiterator" class="reference"> <h1 class="title">The RecursiveTreeIterator class</h1> <div class="partintro"><p class="verinfo">(PHP 5 >= 5.3.0)</p> <div class="section" id="recursivetreeiterator.intro"> <h2 class="title">Introduction</h2> <p class="para"> Allows iterating over a <a href="class.recursiveiterator.html" class="classname">RecursiveIterator</a> to generate an ASCII graphic tree. </p> </div> <div class="section" id="recursivetreeiterator.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">RecursiveTreeIterator</strong> </span> <span class="ooclass"> <span class="modifier">extends</span> <a href="class.recursiveiteratoriterator.html" class="classname">RecursiveIteratorIterator</a> </span> <span class="oointerface">implements <span class="interfacename"><a href="class.outeriterator.html" class="interfacename">OuterIterator</a></span> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.bypass-current"><var class="varname">BYPASS_CURRENT</var></a></var> <span class="initializer"> = 4</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.bypass-key"><var class="varname">BYPASS_KEY</var></a></var> <span class="initializer"> = 8</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-left"><var class="varname">PREFIX_LEFT</var></a></var> <span class="initializer"> = 0</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-mid-has-next"><var class="varname">PREFIX_MID_HAS_NEXT</var></a></var> <span class="initializer"> = 1</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-mid-last"><var class="varname">PREFIX_MID_LAST</var></a></var> <span class="initializer"> = 2</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-end-has-next"><var class="varname">PREFIX_END_HAS_NEXT</var></a></var> <span class="initializer"> = 3</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-end-last"><var class="varname">PREFIX_END_LAST</var></a></var> <span class="initializer"> = 4</span> ;</div> <div class="fieldsynopsis"> <span class="modifier">const</span> <span class="type">integer</span> <var class="fieldsynopsis_varname"><a href="class.recursivetreeiterator.html#recursivetreeiterator.constants.prefix-right"><var class="varname">PREFIX_RIGHT</var></a></var> <span class="initializer"> = 5</span> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.beginchildren.html" class="methodname">beginChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">RecursiveIterator</span> <span class="methodname"><a href="recursivetreeiterator.beginiteration.html" class="methodname">beginIteration</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">RecursiveIterator</span> <span class="methodname"><a href="recursivetreeiterator.callgetchildren.html" class="methodname">callGetChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="recursivetreeiterator.callhaschildren.html" class="methodname">callHasChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="recursivetreeiterator.construct.html" class="methodname">__construct</a></span> ( <span class="methodparam"><span class="type"><span class="type RecursiveIterator|IteratorAggregate">RecursiveIterator|IteratorAggregate</span></span> <code class="parameter">$it</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = RecursiveTreeIterator::BYPASS_KEY</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$cit_flags</code><span class="initializer"> = CachingIterator::CATCH_GET_CHILD</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = RecursiveIteratorIterator::SELF_FIRST</span></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="recursivetreeiterator.current.html" class="methodname">current</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.endchildren.html" class="methodname">endChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.enditeration.html" class="methodname">endIteration</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="recursivetreeiterator.getentry.html" class="methodname">getEntry</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.getpostfix.html" class="methodname">getPostfix</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="recursivetreeiterator.getprefix.html" class="methodname">getPrefix</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="recursivetreeiterator.key.html" class="methodname">key</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.next.html" class="methodname">next</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.nextelement.html" class="methodname">nextElement</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.rewind.html" class="methodname">rewind</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursivetreeiterator.setprefixpart.html" class="methodname">setPrefixPart</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$part</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="recursivetreeiterator.valid.html" class="methodname">valid</a></span> ( <span class="methodparam">void</span> )</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.beginchildren.html" class="methodname">RecursiveIteratorIterator::beginChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.beginiteration.html" class="methodname">RecursiveIteratorIterator::beginIteration</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">RecursiveIterator</span> <span class="methodname"><a href="recursiveiteratoriterator.callgetchildren.html" class="methodname">RecursiveIteratorIterator::callGetChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="recursiveiteratoriterator.callhaschildren.html" class="methodname">RecursiveIteratorIterator::callHasChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="recursiveiteratoriterator.construct.html" class="methodname">RecursiveIteratorIterator::__construct</a></span> ( <span class="methodparam"><span class="type"><a href="class.traversable.html" class="type Traversable">Traversable</a></span> <code class="parameter">$iterator</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = RecursiveIteratorIterator::LEAVES_ONLY</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="recursiveiteratoriterator.current.html" class="methodname">RecursiveIteratorIterator::current</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.endchildren.html" class="methodname">RecursiveIteratorIterator::endChildren</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.enditeration.html" class="methodname">RecursiveIteratorIterator::endIteration</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="recursiveiteratoriterator.getdepth.html" class="methodname">RecursiveIteratorIterator::getDepth</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">iterator</span> <span class="methodname"><a href="recursiveiteratoriterator.getinneriterator.html" class="methodname">RecursiveIteratorIterator::getInnerIterator</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="recursiveiteratoriterator.getmaxdepth.html" class="methodname">RecursiveIteratorIterator::getMaxDepth</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">RecursiveIterator</span> <span class="methodname"><a href="recursiveiteratoriterator.getsubiterator.html" class="methodname">RecursiveIteratorIterator::getSubIterator</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$level</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="recursiveiteratoriterator.key.html" class="methodname">RecursiveIteratorIterator::key</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.next.html" class="methodname">RecursiveIteratorIterator::next</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.nextelement.html" class="methodname">RecursiveIteratorIterator::nextElement</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.rewind.html" class="methodname">RecursiveIteratorIterator::rewind</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="recursiveiteratoriterator.setmaxdepth.html" class="methodname">RecursiveIteratorIterator::setMaxDepth</a></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$max_depth</code><span class="initializer"> = -1</span></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="recursiveiteratoriterator.valid.html" class="methodname">RecursiveIteratorIterator::valid</a></span> ( <span class="methodparam">void</span> )</div> }</div> </div> <div class="section" id="recursivetreeiterator.constants"> <h2 class="title">Predefined Constants</h2> <dl> <dt id="recursivetreeiterator.constants.bypass-current"> <span class="term"><strong><code>RecursiveTreeIterator::BYPASS_CURRENT</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.bypass-key"> <span class="term"><strong><code>RecursiveTreeIterator::BYPASS_KEY</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-left"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_LEFT</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-mid-has-next"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_MID_HAS_NEXT</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-mid-last"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_MID_LAST</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-end-has-next"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_END_HAS_NEXT</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-end-last"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_END_LAST</code></strong></span> <dd> <p class="para"/> </dd> </dt> <dt id="recursivetreeiterator.constants.prefix-right"> <span class="term"><strong><code>RecursiveTreeIterator::PREFIX_RIGHT</code></strong></span> <dd> <p class="para"/> </dd> </dt> </dl> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="recursivetreeiterator.beginchildren.html">RecursiveTreeIterator::beginChildren</a> — Begin children</li><li><a href="recursivetreeiterator.beginiteration.html">RecursiveTreeIterator::beginIteration</a> — Begin iteration</li><li><a href="recursivetreeiterator.callgetchildren.html">RecursiveTreeIterator::callGetChildren</a> — Get children</li><li><a href="recursivetreeiterator.callhaschildren.html">RecursiveTreeIterator::callHasChildren</a> — Has children</li><li><a href="recursivetreeiterator.construct.html">RecursiveTreeIterator::__construct</a> — Construct a RecursiveTreeIterator</li><li><a href="recursivetreeiterator.current.html">RecursiveTreeIterator::current</a> — Get current element</li><li><a href="recursivetreeiterator.endchildren.html">RecursiveTreeIterator::endChildren</a> — End children</li><li><a href="recursivetreeiterator.enditeration.html">RecursiveTreeIterator::endIteration</a> — End iteration</li><li><a href="recursivetreeiterator.getentry.html">RecursiveTreeIterator::getEntry</a> — Get current entry</li><li><a href="recursivetreeiterator.getpostfix.html">RecursiveTreeIterator::getPostfix</a> — Get the postfix</li><li><a href="recursivetreeiterator.getprefix.html">RecursiveTreeIterator::getPrefix</a> — Get the prefix</li><li><a href="recursivetreeiterator.key.html">RecursiveTreeIterator::key</a> — Get the key of the current element</li><li><a href="recursivetreeiterator.next.html">RecursiveTreeIterator::next</a> — Move to next element</li><li><a href="recursivetreeiterator.nextelement.html">RecursiveTreeIterator::nextElement</a> — Next element</li><li><a href="recursivetreeiterator.rewind.html">RecursiveTreeIterator::rewind</a> — Rewind iterator</li><li><a href="recursivetreeiterator.setprefixpart.html">RecursiveTreeIterator::setPrefixPart</a> — Set a part of the prefix</li><li><a href="recursivetreeiterator.valid.html">RecursiveTreeIterator::valid</a> — Check validity</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="recursiveregexiterator.haschildren.html">RecursiveRegexIterator::hasChildren</a></div> <div class="next" style="text-align: right; float: right;"><a href="recursivetreeiterator.beginchildren.html">RecursiveTreeIterator::beginChildren</a></div> <div class="up"><a href="spl.iterators.html">Iterators</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>