array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), 'this' => array ( 0 => 'recursiveregexiterator.haschildren.php', 1 => 'RecursiveRegexIterator::hasChildren', ), 'up' => array ( 0 => 'class.recursiveregexiterator.php', 1 => 'RecursiveRegexIterator', ), 'prev' => array ( 0 => 'recursiveregexiterator.getchildren.php', 1 => 'RecursiveRegexIterator::getChildren', ), 'next' => array ( 0 => 'class.recursivetreeiterator.php', 1 => 'RecursiveTreeIterator', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ru', 'path' => 'reference/spl/recursiveregexiterator/haschildren.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RecursiveRegexIterator::hasChildren — Определяет, возможна ли навигация по содержимому текущего элемента
Определяет, возможна ли навигация по содержимому текущего элемента. В случае, если текущий элемент имеет дочерние элементы, итератор для них можно получить методом RecursiveRegexIterator::getChildren().
У этой функции нет параметров.
Возвращает true
, если возможна навигация по содержимому текущего элемента,
false
в противном случае.
Пример #1 Пример использования RecursiveRegexIterator::hasChildren()
<?php
$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^test/',
RecursiveRegexIterator::ALL_MATCHES);
foreach ($rRegexIterator as $value) {
var_dump($rRegexIterator->hasChildren());
}
?>
Результат выполнения приведённого примера:
bool(false) bool(true)