The RecursiveTreeIterator class
(PHP 5 >= 5.3.0)
Introduction
Allows iterating over a RecursiveIterator to generate an ASCII graphic tree.
Class synopsis
/* Constants */
/* Methods */
public __construct
( RecursiveIterator|IteratorAggregate
$it
[, int $flags
= RecursiveTreeIterator::BYPASS_KEY
[, int $cit_flags
= CachingIterator::CATCH_GET_CHILD
[, int $mode
= RecursiveIteratorIterator::SELF_FIRST
]]] )/* Inherited methods */
public RecursiveIteratorIterator::__construct
( Traversable
}$iterator
[, int $mode
= RecursiveIteratorIterator::LEAVES_ONLY
[, int $flags
= 0
]] )Predefined Constants
RecursiveTreeIterator::BYPASS_CURRENT
RecursiveTreeIterator::BYPASS_KEY
RecursiveTreeIterator::PREFIX_LEFT
RecursiveTreeIterator::PREFIX_MID_HAS_NEXT
RecursiveTreeIterator::PREFIX_MID_LAST
RecursiveTreeIterator::PREFIX_END_HAS_NEXT
RecursiveTreeIterator::PREFIX_END_LAST
RecursiveTreeIterator::PREFIX_RIGHT
Table of Contents
- RecursiveTreeIterator::beginChildren — Begin children
- RecursiveTreeIterator::beginIteration — Begin iteration
- RecursiveTreeIterator::callGetChildren — Get children
- RecursiveTreeIterator::callHasChildren — Has children
- RecursiveTreeIterator::__construct — Construct a RecursiveTreeIterator
- RecursiveTreeIterator::current — Get current element
- RecursiveTreeIterator::endChildren — End children
- RecursiveTreeIterator::endIteration — End iteration
- RecursiveTreeIterator::getEntry — Get current entry
- RecursiveTreeIterator::getPostfix — Get the postfix
- RecursiveTreeIterator::getPrefix — Get the prefix
- RecursiveTreeIterator::key — Get the key of the current element
- RecursiveTreeIterator::next — Move to next element
- RecursiveTreeIterator::nextElement — Next element
- RecursiveTreeIterator::rewind — Rewind iterator
- RecursiveTreeIterator::setPrefixPart — Set a part of the prefix
- RecursiveTreeIterator::valid — Check validity
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Другие базовые расширения
- Стандартная библиотека PHP (SPL)
- Класс AppendIterator
- Класс ArrayIterator
- Класс CachingIterator
- Класс CallbackFilterIterator
- Класс DirectoryIterator
- Класс EmptyIterator
- Класс FilesystemIterator
- Класс FilterIterator
- Класс GlobIterator
- Класс InfiniteIterator
- Класс IteratorIterator
- Класс LimitIterator
- Класс MultipleIterator
- Класс NoRewindIterator
- Класс ParentIterator
- Класс RecursiveArrayIterator
- Класс RecursiveCachingIterator
- Класс RecursiveCallbackFilterIterator
- Класс RecursiveDirectoryIterator
- Класс RecursiveFilterIterator
- Класс RecursiveIteratorIterator
- Класс RecursiveRegexIterator
- Класс RecursiveTreeIterator
- Класс RegexIterator
Коментарии
$it = new RecursiveArrayIterator(array(1, 2, array(3, 4, array(5, 6, 7), 8), 9, 10));
$tit = new RecursiveTreeIterator($it);
foreach( $tit as $key => $value ){
echo $value . PHP_EOL;
}
/* Will output
|-1
|-2
|-Array
| |-3
| |-4
| |-Array
| | |-5
| | |-6
| | \-7
| \-8
|-9
\-10
*/