CallbackFilterIterator

Extends \FilterIterator

CallbackFilterIterator using the callback to determine which items are accepted or rejected.

link

http://php.net/manual/en/class.callbackfilteriterator.php

since

1.2.0

Methods

__construct

Creates a filtered iterator using the callback to determine which items are accepted or rejected.

__construct(\Iterator $iterator, callable $callback) 
throws

\InvalidArgumentException

since

1.2.0

Arguments

$iterator

\IteratorThe iterator to be filtered.

$callback

callableThe callback, which should return TRUE to accept the current item or FALSE otherwise. May be any valid callable value. The callback should accept up to three arguments: the current item, the current key and the iterator, respectively.

                               function my_callback($current, $key, $iterator)

accept

This method calls the callback with the current value, current key and the inner iterator.

accept() : boolean

The callback is expected to return TRUE if the current item is to be accepted, or FALSE otherwise.

link

http://www.php.net/manual/en/callbackfilteriterator.accept.php

since

1.2.0

Response

booleanTrue if the current element is acceptable, otherwise false.

Properties

callback

The callback to check value.

Type(s)

callable