PHP | ArrayIterator seek() Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes 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 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 PHP | ArrayIterator unserialize() Function The ArrayIterator::unserialize() function is an inbuilt function in PHP which is used to unserialize the serialize object. Syntax: void ArrayIterator::unserialize( string $serialized ) Parameters: This function accepts single parameter $serialized which holds the serialize array iterator object. Ret 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 key() Function The ArrayIterator::key() function is an inbuilt function in PHP which returns the current key of the array element. Syntax: mixed ArrayIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current array key. Below programs illustrate 1 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 | ArrayIterator asort() Function The ArrayIterator::asort() function is an inbuilt function in PHP which is used to sort the array values. Syntax: void ArrayIterator::asort( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the ArrayIter 1 min read Like