PHP | AppendIterator next() Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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 illustrate the AppendIterator::next() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator(array('G', 'e', 'e', 'k', 's')); // Create a new AppendIterator $itr = new AppendIterator; // Append the ArrayIterator element $itr->append($arr1); // Display the current element of iterator var_dump($itr->current()); // Use AppendIterator::next() function to // move into next element $itr->next(); // Display the current element of iterator var_dump($itr->current()); ?> Output: string(1) "G" string(1) "e" Program 2: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator( array( "a" => "Geeks", "b" => "for", "c" => "Geeks" ) ); $arr2 = new ArrayIterator( array( "x" => "Computer", "y" => "Science", "z" => "Portal" ) ); // Create a new AppendIterator $itr = new AppendIterator; $itr->append($arr1); $itr->append($arr2); $itr->rewind(); while ($itr->valid()) { echo "ArrayIterator Key: " . $itr->key() . " ArrayIterator Value: " . $itr->current() . "\n"; $itr->next(); } ?> Output: ArrayIterator Key: a ArrayIterator Value: Geeks ArrayIterator Key: b ArrayIterator Value: for ArrayIterator Key: c ArrayIterator Value: Geeks ArrayIterator Key: x ArrayIterator Value: Computer ArrayIterator Key: y ArrayIterator Value: Science ArrayIterator Key: z ArrayIterator Value: Portal Reference: https://www.php.net/manual/en/appenditerator.next.php Comment More infoAdvertise with us Next Article PHP | AppendIterator next() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 | ArrayIterator next() Function The ArrayIterator::next() function is an inbuilt function in PHP which is used to move the iterator to the next entry. Syntax: void ArrayIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate t 1 min read PHP | CachingIterator next() Function The CachingIterator::next() function is an inbuilt function in PHP which is used to move the iterator to the forward. Syntax: void CachingIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate 1 min read PHP | ArrayIterator append() Function The ArrayIterator::append() function is an inbuilt function in PHP which is used to append an element into an array iterator. Syntax: void ArrayIterator::append( mixed $value ) Parameters: This function accepts single parameter $value that holds the value that need to be append. Return Value: This f 1 min read PHP | AppendIterator valid() Function The AppendIterator::valid() function is an inbuilt function in PHP which is used to check the validity of the current element. Syntax: bool AppendIterator::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the current iteration is val 1 min read Like