CachingIterator::getFlags

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

CachingIterator::getFlags — Get flags used

Description

public function CachingIterator::getFlags(): int

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