downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

RegexIterator::__construct> <RegexIterator
[edit] Last updated: Fri, 17 May 2013

view this page in

RegexIterator::accept

(PHP 5 >= 5.2.0)

RegexIterator::acceptGet accept status

Beschreibung

public bool RegexIterator::accept ( void )

Matches (string) RegexIterator::current() (or RegexIterator::key() if the RegexIterator::USE_KEY flag is set) against the regular expression.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

TRUE if a match, FALSE otherwise.

Beispiele

Beispiel #1 RegexIterator::accept() example

This example shows that only items matching the regular expression are accepted.

<?php
$names 
= new ArrayIterator(array('Ann''Bob''Charlie''David'));
$filter = new RegexIterator($names'/^[B-D]/');
foreach (
$filter as $name) {
    echo 
$name PHP_EOL;
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Bob
Charlie
David

Siehe auch



add a note add a note User Contributed Notes RegexIterator::accept - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites