PHP | ArrayIterator seek() Function Last Updated : 21 Nov, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 not return any value. Below programs illustrate the ArrayIterator::seek() 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 ) ); // Seek the position $arrItr->seek(5); // Display the element echo $arrItr->current(); ?> Output: 9 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 if($arrItr->valid()) { // Seek the position $arrItr->seek(3); // Display the element echo $arrItr->current(); } ?> Output: Geeks Reference: https://www.php.net/manual/en/arrayiterator.seek.php Comment More infoAdvertise with us Next Article PHP | ArrayIterator seek() Function K kartik Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | ArrayIterator serialize() Function The ArrayIterator::serialize() function is an inbuilt function in PHP which is used to serialize the array iterator. Syntax: string ArrayIterator::serialize( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the serialized ArrayIterator. Below progr 1 min read PHP | DirectoryIterator seek() Function The DirectoryIterator::seek() function is an inbuilt function in PHP which is used to seek the DirectoryIterator item to the given position. Syntax: void DirectoryIterator::seek( int $position ) Parameters: This function accept single parameter $position which holds the zero-based numeric position t 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 | ArrayIterator uasort() Function The ArrayIterator::uasort() function is an inbuilt function in PHP which is used to sort the element using a user-defined comparison function and maintain their index association. Syntax: void ArrayIterator::uasort( callable $cmp_function ) Parameters: This function accepts a single parameter $cmp_f 2 min read PHP | ArrayIterator uksort() Function The ArrayIterator::uksort() function is an inbuilt function in PHP which is used to sort the keys by using a user-defined comparison function. Syntax: void ArrayIterator::uksort( callable $cmp_function ) Parameters: This function accepts single parameter $cmp_function which holds the user defined co 2 min read Like