표준 PHP 라이브러리(SPL) RegexIterator::getFlags
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RegexIterator::getFlags — Get flags
설명
public RegexIterator::getFlags(): int
플래그를 반환합니다. 사용 가능한 플래그 목록은 RegexIterator::setFlags()를 참조하세요.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
설정된 플래그를 반환합니다.
Examples
예제 #1 RegexIterator::getFlags() 예제
<?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);
if ($regexIterator->getFlags() & RegexIterator::USE_KEY) {
echo 'Filtering based on the array keys.';
} else {
echo 'Filtering based on the array values.';
}
?>
위의 예는 다음을 출력합니다.
Filtering based on the array keys.
기타
- RegexIterator::setFlags() - Sets the flags