PHP | CachingIterator __construct() Function Last Updated : 20 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The CachingIterator::__construct() function is an inbuilt function in PHP which is used to construct a new CachingIterator object for the iterator. Syntax: public CachingIterator::__construct( Iterator $iterator, int $flags = self::CALL_TOSTRING ) Parameters: This function accepts two parameters as mentioned above and described below: $iterator: This parameter holds the iterator of cache. $flags: This parameter holds the bitmask of flags. Return Value: This function does not return any value. Below programs illustrate the CachingIterator::__construct() function in PHP: Program 1: php <?php // Declare an array $arr = array('G', 'e', 'e', 'k', 's'); // Create a new CachingIterator $cachIt = new CachingIterator( new ArrayIterator($arr), CachingIterator::FULL_CACHE ); // Display the result foreach($cachIt as $element) { echo $element . " "; } ?> Output: G e e k s Program 2: php <?php // Declare an ArrayIterator $arr = array( "a" => "Geeks", "b" => "for", "c" => "Geeks", "d" => "Computer", "e" => "Science", "f" => "Portal" ); // Create a new CachingIterator $cachIt = new CachingIterator( new ArrayIterator($arr), CachingIterator::FULL_CACHE ); // Display the result foreach($cachIt as $key => $value) { echo $key . " => " . $value . "\n"; } ?> Output: a => Geeks b => for c => Geeks d => Computer e => Science f => Portal Reference: https://www.php.net/manual/en/cachingiterator.construct.php Comment More infoAdvertise with us Next Article PHP | CachingIterator __construct() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Iterators Similar Reads PHP | AppendIterator __construct() Function The AppendIterator::__construct() function is an inbuilt function in PHP which is used to construct an AppendIterator. Syntax: public AppendIterator::__construct( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs il 2 min read PHP | AppendIterator __construct() Function The AppendIterator::__construct() function is an inbuilt function in PHP which is used to construct an AppendIterator. Syntax: public AppendIterator::__construct( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs il 2 min read PHP | AppendIterator __construct() Function The AppendIterator::__construct() function is an inbuilt function in PHP which is used to construct an AppendIterator. Syntax: public AppendIterator::__construct( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs il 2 min read PHP | CachingIterator current() Function The CachingIterator::current() function is an inbuilt function in PHP which is used to return the current element. Syntax: mixed CachingIterator::current( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current value of CachingIterator. Below 1 min read PHP | CachingIterator current() Function The CachingIterator::current() function is an inbuilt function in PHP which is used to return the current element. Syntax: mixed CachingIterator::current( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current value of CachingIterator. Below 1 min read PHP | CachingIterator current() Function The CachingIterator::current() function is an inbuilt function in PHP which is used to return the current element. Syntax: mixed CachingIterator::current( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current value of CachingIterator. Below 1 min read PHP ArrayIterator __construct() Function The ArrayIterator::__construct() function is an inbuilt function in PHP which is used to construct an ArrayIterator. Syntax: public ArrayIterator::__construct( mixed $array, int $flags = 0 ) Parameters: This function accepts two parameters as mentioned above and described below: $array: This paramet 1 min read PHP ArrayIterator __construct() Function The ArrayIterator::__construct() function is an inbuilt function in PHP which is used to construct an ArrayIterator. Syntax: public ArrayIterator::__construct( mixed $array, int $flags = 0 ) Parameters: This function accepts two parameters as mentioned above and described below: $array: This paramet 1 min read PHP ArrayIterator __construct() Function The ArrayIterator::__construct() function is an inbuilt function in PHP which is used to construct an ArrayIterator. Syntax: public ArrayIterator::__construct( mixed $array, int $flags = 0 ) Parameters: This function accepts two parameters as mentioned above and described below: $array: This paramet 1 min read PHP | CachingIterator key() Function The CachingIterator::key() function is an inbuilt function in PHP which is used to return the key for the current element. Syntax: scalar CachingIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the key value of the current element. B 1 min read Like