在线文档教程
PHP
SPL/Iterators

AppendIterator::append

AppendIterator::append

(PHP 5 >= 5.1.0, PHP 7)

AppendIterator::append — Appends an iterator

Description

public void AppendIterator::append ( Iterator $iterator )

Appends an iterator.

Parameters

iterator

The iterator to append.

Return Values

No value is returned.

Examples

Example #1 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() - Constructs an AppendIterator

← AppendIterator

AppendIterator::__construct →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/appenditerator.append.php