Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10997

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>Get accept status</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.regexiterator.html">RegexIterator</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="regexiterator.construct.html">RegexIterator::__construct</a></div>
 <div class="up"><a href="class.regexiterator.html">RegexIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="regexiterator.accept" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">RegexIterator::accept</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0)</p><p class="refpurpose"><span class="refname">RegexIterator::accept</span> &mdash; <span class="dc-title">Get accept status</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-regexiterator.accept-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>RegexIterator::accept</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Matches <em>(string)</em>  <span class="methodname"><strong>RegexIterator::current()</strong></span>
   (or  <span class="methodname"><strong>RegexIterator::key()</strong></span> if the
   <a href="class.regexiterator.html#regexiterator.constants.use-key" class="link">RegexIterator::USE_KEY</a> flag is set)
   against the regular expression.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-regexiterator.accept-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-regexiterator.accept-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   <strong><code>TRUE</code></strong> if a match, <strong><code>FALSE</code></strong> otherwise.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-regexiterator.accept-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="regexiterator.accept.example.basic">
    <p><strong>Example #1  <span class="methodname"><strong>RegexIterator::accept()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     This example shows that only items matching the regular expression are accepted.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$names&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">ArrayIterator</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'Ann'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Bob'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Charlie'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'David'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$filter&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">RegexIterator</span><span style="color: #007700">(</span><span style="color: #0000BB">$names</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/^[B-D]/'</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">$filter&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$name</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$name&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<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>
Bob
Charlie
David
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-regexiterator.accept-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="class.regexiterator.html#regexiterator.constants" class="link">RegexIterator constants</a></li>
    <li class="member"> <span class="methodname"><a href="regexiterator.setflags.html" class="methodname" rel="rdfs-seeAlso">RegexIterator::setFlags()</a> - Sets the flags.</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="class.regexiterator.html">RegexIterator</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="regexiterator.construct.html">RegexIterator::__construct</a></div>
 <div class="up"><a href="class.regexiterator.html">RegexIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>