Flatten List Recursively | ARRAY_FLATTEN_DEEP

Syntax

ARRAY_FLATTEN_DEEP( [value] )

Parameters

value
An ARRAY of nested ARRAYS to join into a single ARRAY. If not an ARRAY, it will be coerced into an array with the ARRAY method.

Return Value

An ARRAY with all inner items joined into a single ARRAY.

Description

Transform an ARRAY of ARRAYS into a single ARRAY. This method is recursive. For shallow flattening using the ARRAY_FLATTEN method instead.

Examples

# VALUE is [[1, 2], [3], [4, 5, 6]]
ARRAY_FLATTEN_DEEP(VALUE) # returns [1, 2, 3, 4, 5, 6]
# VALUE is [[1, 2], 3, [4, 5, 6], 7]
ARRAY_FLATTEN_DEEP(VALUE) # returns [1, 2, 3, 4, 5, 6, 7]
Does deep flattening.
# VALUE is [[[1, 2], [3]], [[4, 5, 6]], [7]]
ARRAY_FLATTEN_DEEP(VALUE) # returns [1, 2, 3, 4, 5, 6, 7]
Coerces the passed in value to an array before performing the operation.
ARRAY_FLATTEN_DEEP(true) # returns [TRUE]