Documentation

FilteredIterator extends ArrayIterator
in package

FinalYes

Iterator for arrays requiring filtered values

Table of Contents

Properties

$callback  : callable
Callback to run as a filter

Methods

__construct()  : mixed
Create a new iterator
__unserialize()  : void
Prevent unserialization of the object for security reasons.
__wakeup()  : void
Perform reinitialization tasks.
current()  : string
Get the current item's value after filtering
unserialize()  : void
Prevent creating a PHP value from a stored representation of the object for security reasons.

Properties

Methods

__construct()

Create a new iterator

public __construct(array<string|int, mixed> $data, callable $callback) : mixed
Parameters
$data : array<string|int, mixed>

The array or object to be iterated on.

$callback : callable

Callback to be called on each value

Tags
throws
InvalidArgument

When the passed $data argument is not iterable.

__unserialize()

Prevent unserialization of the object for security reasons.

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

Restored array of data originally serialized.

Tags
phpcs:disable

PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound

Attributes
#[ReturnTypeWillChange]

__wakeup()

Perform reinitialization tasks.

public __wakeup() : void

Prevents a callback from being injected during unserialization of an object.

unserialize()

Prevent creating a PHP value from a stored representation of the object for security reasons.

public unserialize(string $data) : void
Parameters
$data : string

The serialized string.

Attributes
#[ReturnTypeWillChange]

        
On this page

Search results