<!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>Create a filtered iterator from another iterator</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="callbackfilteriterator.accept.html">CallbackFilterIterator::accept</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.directoryiterator.html">DirectoryIterator</a></div> <div class="up"><a href="class.callbackfilteriterator.html">CallbackFilterIterator</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="callbackfilteriterator.construct" class="refentry"> <div class="refnamediv"> <h1 class="refname">CallbackFilterIterator::__construct</h1> <p class="verinfo">(PHP 5 >= 5.4.0)</p><p class="refpurpose"><span class="refname">CallbackFilterIterator::__construct</span> — <span class="dc-title">Create a filtered iterator from another iterator</span></p> </div> <div class="refsect1 description" id="refsect1-callbackfilteriterator.construct-description"> <h3 class="title">Description</h3> <div class="constructorsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>CallbackFilterIterator::__construct()</strong></span> ( <span class="methodparam"><span class="type"><a href="class.iterator.html" class="type Iterator">Iterator</a></span> <code class="parameter">$iterator</code></span> , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span> )</div> <p class="para rdfs-comment"> Creates a filtered iterator using the <em><code class="parameter">callback</code></em> to determine which items are accepted or rejected. </p> </div> <div class="refsect1 parameters" id="refsect1-callbackfilteriterator.construct-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">iterator</code></em></span> <dd> <p class="para"> The iterator to be filtered. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">callback</code></em></span> <dd> <p class="para"> The callback, which should return <strong><code>TRUE</code></strong> to accept the current item or <strong><code>FALSE</code></strong> otherwise. See <a href="class.callbackfilteriterator.html#callbackfilteriterator.examples" class="link">Examples</a>. </p> <p class="para"> May be any valid <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> value. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-callbackfilteriterator.construct-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 seealso" id="refsect1-callbackfilteriterator.construct-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="class.callbackfilteriterator.html#callbackfilteriterator.examples" class="link">CallbackFilterIterator Examples</a></li> <li class="member"> <span class="methodname"><a href="callbackfilteriterator.accept.html" class="methodname" rel="rdfs-seeAlso">CallbackFilterIterator::accept()</a> - Calls the callback with the current value, the current key and the inner iterator as arguments</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="callbackfilteriterator.accept.html">CallbackFilterIterator::accept</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.directoryiterator.html">DirectoryIterator</a></div> <div class="up"><a href="class.callbackfilteriterator.html">CallbackFilterIterator</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>