PHP | ArrayIterator next() Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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 the ArrayIterator::next() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array('G', 'e', 'e', 'k', 's', 'f', 'o', 'r') ); // Display the elements while($arrItr->valid()) { echo $arrItr->current(); $arrItr->next(); } ?> Output: Geeksfor Program 2: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array("Geeks", "for", "Geeks") ); // Display value of array iterator echo $arrItr->current() . "\n"; // Use next() function to move // element into next position $arrItr->next(); // Display value of array iterator echo $arrItr->current() . "\n"; // Use next() function to move // element into next position $arrItr->next(); // Display value of array iterator echo $arrItr->current(); ?> Output: Geeks for Geeks Reference: https://www.php.net/manual/en/arrayiterator.next.php Comment More infoAdvertise with us Next Article PHP | ArrayIterator next() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 natsort() Function The ArrayIterator::natsort() function is an inbuilt function in PHP which is used to sort an array naturally. Syntax: void ArrayIterator::natsort( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the Arr 1 min read PHP | ArrayIterator ksort() Function The ArrayIterator::ksort() function is an inbuilt function in PHP which is used to sort the array element by key. Syntax: void ArrayIterator::ksort( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate the A 2 min read PHP | ArrayIterator getFlags() Function The ArrayIterator::getFlags() function is an inbuilt function in PHP which is used to get the behavior of flags of array iterator. Syntax: int ArrayIterator::getFlags( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the behavior flags of the Array 1 min read PHP | DirectoryIterator next() Function The DirectoryIterator::next() function is an inbuilt function in PHP which is used to move forward to the next DirectoryIterator item. Syntax: void DirectoryIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below p 1 min read Like