function test($ar, $flags) { echo "==={$flags}===\n"; $it = new CachingIterator($ar, 0); try { $it->setFlags($flags); } catch (Exception $e) { echo 'Exception: ' . $e->getMessage() . "\n"; var_dump($it->getFlags()); return; } var_dump($it->getFlags()); try { foreach ($it as $v) { var_dump((string) $it); } } catch (Exception $e) { echo 'Exception: ' . $e->getMessage() . "\n"; } }
<?php $ai = new ArrayIterator(array('foo', 'bar')); $ci = new CachingIterator($ai); $ci->setFlags(); //expects arg