PHP | AppendIterator getIteratorIndex() Function Last Updated : 20 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The AppendIterator::getIteratorIndex() function is an inbuilt function in PHP which is used to get the index of the current inner iterator. Syntax: int AppendIterator::getIteratorIndex( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an integer value which is the zero-based index of the current inner iterator. Below programs illustrate the AppendIterator::getIteratorIndex() function in PHP: Program 1: 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); // Display the elements foreach ($itr as $key => $val) { echo "Iterator Index: " . $itr->getIteratorIndex() . " Key : " . $key . " Value: " . $val . "\n"; } ?> Output: Iterator Index: 0 Key : 0 Value: Geeks Iterator Index: 0 Key : 1 Value: for Iterator Index: 0 Key : 2 Value: Geeks Iterator Index: 1 Key : 0 Value: Computer Iterator Index: 1 Key : 1 Value: Science Iterator Index: 1 Key : 2 Value: Portal Program 2: php <?php // Declare an ArrayIterator $arr1 = new ArrayIterator( array( "a" => "Geeks", "b" => "for", "c" => "Geeks" ) ); $arr2 = new ArrayIterator( array( "x" => "Computer", "y" => "Science", "z" => "Portal" ) ); // Create a new AppendIterator $itr = new AppendIterator; $itr->append($arr1); $itr->append($arr2); // Display the elements foreach ($itr as $key => $val) { echo "Iterator Index: " . $itr->getIteratorIndex() . " Key : " . $key . " Value: " . $val . "\n"; } ?> Output: Iterator Index: 0 Key : a Value: Geeks Iterator Index: 0 Key : b Value: for Iterator Index: 0 Key : c Value: Geeks Iterator Index: 1 Key : x Value: Computer Iterator Index: 1 Key : y Value: Science Iterator Index: 1 Key : z Value: Portal Reference: https://www.php.net/manual/en/appenditerator.getiteratorindex.php Comment More infoAdvertise with us Next Article PHP | AppendIterator getIteratorIndex() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | AppendIterator next() Function The AppendIterator::next() function is an inbuilt function in PHP which is used to move the element into the next element. Syntax: void AppendIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustr 2 min read PHP | CachingIterator getInnerIterator() Function The CachingIterator::getInnerIterator() function is an inbuilt function in PHP which is used to return the iterator sent to the constructor. Syntax: Iterator CachingIterator::getInnerIterator( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an obj 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 ArrayObject getIterator() Function in PHP The getIterator() function of the ArrayObject class in PHP is used to create an iterator from an ArrayObject instance. This iterator can be used to iterate through the array of the respective ArrayObject. Syntax: ArrayIterator getIterator() Parameters: This function does not accepts any parameters. 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 | Imagick getIteratorIndex() Function The Imagick::getIteratorIndex() function is an inbuilt function in PHP which is used to get the index of the current active image. This is a alternate for getImageIndex() function. Syntax: int Imagick::getIteratorIndex( void ) Parameters: This function doesnât accepts any parameter. Return Value: Th 1 min read PHP | CachingIterator getCache() Function The CachingIterator::getCache() function is an inbuilt function in PHP which is used to retrieve the contents of the cache. Syntax: array CachingIterator::getCache( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an array containing the cache item 2 min read PHP | DirectoryIterator getATime() Function The DirectoryIterator::getATime() function is an inbuilt function in PHP which is used to get the last access time of the current DirectoryIterator item. Syntax: int DirectoryIterator::getATime( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the 2 min read PHP | ArrayIterator append() Function The ArrayIterator::append() function is an inbuilt function in PHP which is used to append an element into an array iterator. Syntax: void ArrayIterator::append( mixed $value ) Parameters: This function accepts single parameter $value that holds the value that need to be append. Return Value: This f 1 min read ArrayObject getIteratorClass() Function in PHP The getIteratorClass() function of the ArrayObject class in PHP is used to get the classname of the iterator used to iterate over this ArrayObject. Syntax: string getIteratorClass() Parameters: This function does not accepts any parameters. Return Value: This function returns the iterator classname 1 min read Like