AppendIterator::append

(PHP 5 >= 5.1.0, PHP 7)
Appends an iterator
public void AppendIterator::append ( Iterator $iterator )

Appends an iterator.

Parameters:
iterator

The iterator to append.

Returns:

No value is returned.

Examples:
AppendIterator::append() example
<?php
$array_a = new ArrayIterator(array('a', 'b', 'c'));
$array_b = new ArrayIterator(array('d', 'e', 'f'));

$iterator = new AppendIterator;
$iterator->append($array_a);
$iterator->append($array_b);

foreach ($iterator as $current) {
    echo $current;
}
?>

The above example will output:

abcdef
See also:

AppendIterator::__construct() -

doc_php
2016-02-24 16:19:36
Comments
Leave a Comment

Please login to continue.