FilteredIterator::__construct( array $data, callable $callback )

In this article

Create a new iterator

Parameters

$dataarrayrequired
The array or object to be iterated on.
$callbackcallablerequired
Callback to be called on each value

Source

public function __construct($data, $callback) {
	if (InputValidator::is_iterable($data) === false) {
		throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));
	}

	parent::__construct($data);

	if (is_callable($callback)) {
		$this->callback = $callback;
	}
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.