PHP | ArrayIterator rewind() Function Last Updated : 20 Nov, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 illustrate the ArrayIterator::rewind() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array( "a" => 4, "b" => 2, "g" => 8, "d" => 6, "e" => 1, "f" => 9 ) ); // Move to last position $arrItr->seek(5); // Display the next value var_dump($arrItr->next()); // Move to start position $arrItr->rewind(); // Display the current element echo $arrItr->current(); ?> Output: NULL 4 Program 2: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array( "b" => "for", "a" => "Geeks", "e" => "Science", "c" => "Geeks", "f" => "Portal", "d" => "Computer" ) ); // Check the validity of ArrayIterator while($arrItr->valid()) { $arrItr->next(); } // Move to start position $arrItr->rewind(); // Display the current element echo $arrItr->current(); ?> Output: for Reference: https://www.php.net/manual/en/arrayiterator.rewind.php Comment More infoAdvertise with us Next Article PHP | ArrayIterator valid() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Iterators PHP-ArrayIterator +1 More Similar Reads 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 PHP | ArrayIterator valid() Function The ArrayIterator::valid() function is an inbuilt function in PHP which is used to check whether an array contains more entries or not. Syntax: bool ArrayIterator::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the iterator is vali 1 min read PHP | ArrayIterator seek() Function The ArrayIterator::seek() function is an inbuilt function in PHP which is used to seek the position of an array iterator. Syntax: void ArrayIterator::seek( int $position ) Parameters: This function accepts single parameter $position which holds the position to seek. Return Value: This function does 1 min read PHP | ArrayIterator seek() Function The ArrayIterator::seek() function is an inbuilt function in PHP which is used to seek the position of an array iterator. Syntax: void ArrayIterator::seek( int $position ) Parameters: This function accepts single parameter $position which holds the position to seek. Return Value: This function does 1 min read PHP | AppendIterator rewind() Function 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. B 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 Like