PHP | AppendIterator __construct() Function Last Updated : 21 Nov, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The AppendIterator::__construct() function is an inbuilt function in PHP which is used to construct an AppendIterator. Syntax: public AppendIterator::__construct( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the AppendIterator::__construct() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator(array('G', 'e', 'e', 'k', 's')); $arr2 = new ArrayIterator(array('f', 'o', 'r')); $arr3 = new ArrayIterator(array('G', 'e', 'e', 'k', 's')); // Create a new AppendIterator $itr = new AppendIterator; $itr->append($arr1); $itr->append($arr2); $itr->append($arr3); // Display the result foreach ($itr as $key => $val) { echo $key . " => " . $val . PHP_EOL; } ?> Output: 0 => G 1 => e 2 => e 3 => k 4 => s 0 => f 1 => o 2 => r 0 => G 1 => e 2 => e 3 => k 4 => s Program 2: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator(array("Geeks", "for", "Geeks")); $arr2 = new ArrayIterator(array("Computer", "Science", "Portal")); // Create a new AppendIterator $itr = new AppendIterator; $itr->append($arr1); $itr->append($arr2); // Display the result foreach ($itr as $key => $val) { echo $key . " => " . $val . PHP_EOL; } ?> Output: 0 => Geeks 1 => for 2 => Geeks 0 => Computer 1 => Science 2 => Portal Reference: https://www.php.net/manual/en/appenditerator.construct.php Comment More infoAdvertise with us Next Article PHP ArrayIterator __construct() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP ArrayIterator __construct() Function The ArrayIterator::__construct() function is an inbuilt function in PHP which is used to construct an ArrayIterator. Syntax: public ArrayIterator::__construct( mixed $array, int $flags = 0 ) Parameters: This function accepts two parameters as mentioned above and described below: $array: This paramet 1 min read PHP | CachingIterator __construct() Function The CachingIterator::__construct() function is an inbuilt function in PHP which is used to construct a new CachingIterator object for the iterator. Syntax: public CachingIterator::__construct( Iterator $iterator, int $flags = self::CALL_TOSTRING ) Parameters: This function accepts two parameters as 2 min read PHP | AppendIterator current() Function The AppendIterator::current() function is an inbuilt function in PHP which is used to get the current value. Syntax: mixed AppendIterator::current( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current value if it is valid or NULL otherwise. 1 min read PHP | AppendIterator key() Function The AppendIterator::key() function is an inbuilt function in PHP which is used to return the current key. Syntax: scalar AppendIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current key if it is valid or NULL otherwise. Below p 2 min read PHP | Collator __construct() Function The Collator::__construct() function is an inbuilt function in PHP which is used to create a new instance of Collator. Syntax: public Collator::__construct( string $locale ) Parameters: This function accepts single parameter $locale which holds the collation rules. If a null value is passed for the 1 min read PHP | AppendIterator next() Function The AppendIterator::next() function is an inbuilt function in PHP which is used to move the element into the next element. Syntax: void AppendIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustr 2 min read Like