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

search for in the

RegexIterator::setMode> <RegexIterator::getRegex
[edit] Last updated: Fri, 25 May 2012

view this page in

RegexIterator::setFlags

(PHP 5 >= 5.2.0)

RegexIterator::setFlagsフラグを設定する

説明

public void RegexIterator::setFlags ( int $flags )

フラグを設定します。

パラメータ

flags

設定するフラグ。クラス定数のビットマスクで指定します。

利用できるフラグは次のとおりです。これらのフラグの実際の意味については 定義済みの定数 で説明します。

RegexIterator のフラグ
定数
1 RegexIterator::USE_KEY

返り値

値を返しません。

例1 RegexIterator::setFlags() の例

新しい RegexIterator を作成します。これは、キーが 'test' ではじまるすべてのエントリを取り出します。

<?php
$test 
= array ('str1' => 'test 1''teststr2' => 'another test''str3' => 'test 123');

$arrayIterator = new ArrayIterator($test);
$regexIterator = new RegexIterator($arrayIterator'/^test/');
$regexIterator->setFlags(RegexIterator::USE_KEY);

foreach (
$regexIterator as $key => $value) {
    echo 
$key ' => ' $value "\n";
}
?>

上の例の出力は以下となります。

teststr2 => another test

参考



add a note add a note User Contributed Notes RegexIterator::setFlags
There are no user contributed notes for this page.

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