(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::getFlags — Get flags used
Gets the bitmask of the flags used for this CachingIterator instance.
This function has no parameters.
Returns a bitmask of the CachingIterator constants. Use the bitwise & operator to check whether a given flag is set.
Example #1 Checking whether a flag is set
<?php
$iterator = new CachingIterator(
new ArrayIterator(['a', 'b', 'c']),
CachingIterator::TOSTRING_USE_KEY | CachingIterator::FULL_CACHE
);
var_dump((bool) ($iterator->getFlags() & CachingIterator::FULL_CACHE));
var_dump((bool) ($iterator->getFlags() & CachingIterator::CALL_TOSTRING));
?>The above example will output:
bool(true) bool(false)