filter.php
Table of Contents
Functions
- filter() : object
- Keeps the public properties of an object that satisfy a predicate.
Functions
filter()
Keeps the public properties of an object that satisfy a predicate.
filter(object $object, callable $fn) : object
Returns a new stdClass containing only the properties for which
fn( $value , $key ) returns a truthy value. The source object is never modified.
Parameters
- $object : object
-
The source object.
- $fn : callable
-
The predicate callback:
fn( $value , $key ): bool.
Tags
Return values
object —A new stdClass with only the kept properties.