PHP | AppendIterator rewind() Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The AppendIterator::rewind() function is an inbuilt function in PHP which is used to rewind to the first element of the first inner Iterator. Syntax: void AppendIterator::rewind( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the AppendIterator::rewind() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator(array("Geeks", "for", "Geeks")); // Create a new AppendIterator $itr = new AppendIterator; $itr->append($arr1); // Using rewind function $itr->rewind(); // Get current data var_dump($itr->current()); // Move on to next object $itr->next(); // Get current data var_dump($itr->current()); // Again using rewind function $itr->rewind(); // Get current data var_dump($itr->current()); ?> Output: string(5) "Geeks" string(3) "for" string(5) "Geeks" 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); // Using rewind function $itr->rewind(); while($itr->valid()) { var_dump($itr->current()); // Moving to next element $itr->next(); } ?> Output: string(5) "Geeks" string(3) "for" string(5) "Geeks" string(8) "Computer" string(7) "Science" string(6) "Portal" Reference: https://www.php.net/manual/en/appenditerator.rewind.php Comment More infoAdvertise with us Next Article PHP | AppendIterator rewind() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 PHP | ArrayIterator rewind() Function The ArrayIterator::rewind() function is an inbuilt function in PHP which is used to rewind the array back to the start. Syntax: void ArrayIterator::rewind( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrat 1 min read PHP | CachingIterator rewind() Function The CachingIterator::rewind() function is an inbuilt function in PHP which is used to rewind the iterator. Syntax: void CachingIterator::rewind( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the Cachi 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 | DirectoryIterator rewind() Function The DirectoryIterator::rewind() function is an inbuilt function in PHP which is used to rewind the DirectoryIterator back to the start position. Syntax: void DirectoryIterator::rewind( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any va 2 min read Like