CachingIterator::getFlags
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::getFlags — Get flags used
Description
Gets the bitmask of the flags used for this CachingIterator instance.
Parameters
This function has no parameters.
Return Values
Returns a bitmask of the CachingIterator constants. Use the bitwise & operator to check whether a given flag is set.
Examples
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)
See Also
- CachingIterator::setFlags() - Set the flags for the CachingIterator object
- CachingIterator::__construct() - Construct a new CachingIterator object for the iterator
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
