RegexIterator::getPregFlags

(PHP 5 >= 5.2.0, PHP 7)

RegexIterator::getPregFlagsReturns the regular expression flags

说明

public RegexIterator::getPregFlags ( void ) : int

Returns the regular expression flags, see RegexIterator::__construct() for the list of flags.

返回值

Returns a bitmask of the regular expression flags.

范例

Example #1 RegexIterator::getPregFlags() example

<?php

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

$arrayIterator = new ArrayIterator($test);
$regexIterator = new RegexIterator($arrayIterator'/\s/'RegexIterator::SPLIT);
$regexIterator->setPregFlags(PREG_SPLIT_NO_EMPTY PREG_SPLIT_OFFSET_CAPTURE);

if (
$regexIterator->getPregFlags() & PREG_SPLIT_NO_EMPTY) {
    echo 
'Ignoring empty pieces';
} else {
    echo 
'Not ignoring empty pieces';
}

?>

以上例程会输出:

Ignoring empty pieces

参见

相关文章
php domxpath evaluates the given xpath expression and returns a typed result if possiblephp 多字节字符串 函数 perform a regular expression search and replace with multibyte support using a callbackphp 多字节字符串 函数 replace regular expression with multibyte supportphp 多字节字符串 函数 returns start point for next regular expression matchphp 多字节字符串 函数 retrieve the result from the last multibyte regular expression matchphp 多字节字符串 函数 setup string and regular expression for a multibyte regular expression matchphp 多字节字符串 函数 returns position and length of a matched part of the multibyte regular expression for a predefined multibyte stringphp 多字节字符串 函数 returns the matched part of a multibyte regular expressionphp 多字节字符串 函数 set start point of next regular expression matchphp 多字节字符串 函数 multibyte regular expression match for predefined multibyte stringphp 多字节字符串 函数 regular expression match with multibyte supportphp pcre 函数 perform a regular expression search and replace using callbacksphp mongodb bson regex returns the regex s flagsphp mongodb bson regexinterface returns the regexinterface s flagsphp pharfileinfo returns the phar file entry flagsphp regexiterator returns the regular expression flagsphp regexiterator returns current regular expressionphp regexiterator sets the regular expression flagsphp solrquery returns the regular expression for fragmentingphp solrquery specify the regular expression for fragmenting
关注编程学问公众号