Oihana PHP

ClearableArrayable

Interface for objects that can be converted to an array, with an option to remove empty or null values.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Methods

toArray()  : array<string|int, mixed>
Converts the object to an associative array.

Methods

toArray()

Converts the object to an associative array.

public toArray([bool $clear = false ]) : array<string|int, mixed>

If $clear is true, removes entries with null or empty values.

Parameters
$clear : bool = false

Whether to remove null or empty values from the array. Default: false.

Return values
array<string|int, mixed>

The array representation of the object.


        
On this page

Search results