<?php declare(strict_types=1); namespace App; use Generator; use CachingIterator; $generator = /** * @return Generator<bool, bool> */ static function (): Generator { yield true => true; yield false => false; }; $iterator = new CachingIterator($generator(), CachingIterator::FULL_CACHE); foreach ($iterator as $k => $v) { var_dump($k, $v); } foreach ($iterator->getCache() as $k => $v) { var_dump($k, $v); }
You have javascript disabled. You will not be able to edit any code.