CachingIterator::getFlags

Get flags used

Description

public int CachingIterator::getFlags()

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
  • CachingIterator::__construct