RecursiveRegexIterator::getChildren

(PHP 5 >= 5.2.0, PHP 7)

RecursiveRegexIterator::getChildrenReturns an iterator for the current entry

说明

public RecursiveRegexIterator::getChildren ( void ) : RecursiveRegexIterator

Returns an iterator for the current iterator entry.

参数

此函数没有参数。

返回值

An iterator for the current entry, if it can be iterated over by the inner iterator.

错误/异常

An InvalidArgumentException will be thrown if the current entry does not contain a value that can be iterated over by the inner iterator.

范例

Example #1 RecursiveRegexIterator::getChildren() example

<?php
$rArrayIterator 
= new RecursiveArrayIterator(array('test1', array('tet3''test4''test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator'/^test/',
    
RecursiveRegexIterator::ALL_MATCHES);

foreach (
$rRegexIterator as $key1 => $value1) {

    if (
$rRegexIterator->hasChildren()) {

        
// print all children
        
echo "Children: ";
        foreach (
$rRegexIterator->getChildren() as $key => $value) {
            echo 
$value " ";
        }
        echo 
"\n";
    } else {
        echo 
"No children\n";
    }

}
?>

以上例程会输出:

No children
Children: test4 test5

参见

相关文章
php callbackfilteriterator calls the callback with the current value the current key and the inner iterator as argumentsphp set returns the current capacityphp eventbufferevent returns the current cipher name of the ssl connectionphp maxdb 函数 returns the thread id for the current connectionphp imagickpixeliterator returns the current pixel iterator rowphp outeriterator returns the inner iterator for the current entryphp recursivearrayiterator returns an iterator for the current entry if it is an array or an objectphp recursivearrayiterator returns whether current entry is an array or an objectphp recursivedirectoryiterator returns an iterator for the current entry if it is a directoryphp recursivedirectoryiterator returns whether current entry is a directory and not . or .. php recursivedirectoryiterator return path and filename of current dir entryphp recursiveiterator returns an iterator for the current entryphp recursiveiterator returns if an iterator can be created for the current entryphp recursiveregexiterator returns an iterator for the current entryphp recursiveregexiterator returns whether an iterator can be obtained for the current entryphp splobjectstorage returns the current storage entryphp splobjectstorage returns the data associated with the current iterator entryphp splobjectstorage sets the data associated with the current iterator entryphp splobjectstorage returns if the current iterator entry is validphp swoole connection iterator return current connection entry.
关注编程学问公众号