ArrayObject getIteratorClass() Function in PHP Last Updated : 22 Mar, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 for this ArrayObject. Below programs illustrate the above function: Program 1: php <?php // PHP program to illustrate the // getIteratorClass() function $arr = array("a" => "geeks", "b" => "are", "c" => "awesome"); // Create array object $arrObject = new ArrayObject($arr); // Fetch the iterator classname $itrClassName = $arrObject->getIteratorClass(); // Print the iterator classname print($itrClassName); ?> Output: ArrayIterator Program 2: php <?php // PHP program to illustrate the // getIteratorClass() function // Create a custom interator class SampleIterator extends ArrayIterator{ } $arr = array("a" => "geeks", "b" => "are", "c" => "awesome"); // Create array object $arrObject = new ArrayObject($arr); // Set new iterator $arrObject->setIteratorClass('SampleIterator'); // Fetch the iterator classname $itrClassName = $arrObject->getIteratorClass(); // Print the iterator classname print($itrClassName); ?> Output: SampleIterator Reference: http://php.net/manual/en/arrayobject.getiteratorclass.php Comment More infoAdvertise with us Next Article ArrayObject getIteratorClass() Function in PHP G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function PHP-ArrayObject +1 More Similar Reads 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 | ArrayObject setIteratorClass() Function The ArrayObject::setIteratorClass() function is an inbuilt function in PHP which is used to set the iterator classname for the ArrayObject. Syntax: void ArrayObject::setIteratorClass( string $iterator_class ) Parameters: This function accepts single parameter $iterator_class which holds the class na 2 min read PHP | ArrayObject getFlags() Function The ArrayObject::getFlags() function is an inbuilt function in PHP which is used to get the behavior of flags of the ArrayObject. Syntax: int ArrayObject::getFlags( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the behavior flags of the ArrayObj 2 min read PHP | AppendIterator getIteratorIndex() Function 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 va 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 Like