RockLobsterInc\Functions

exclude_blank() │ CF7 1.0

Excludes unset or blank text values from the given array.

Хуков нет.

Возвращает

array. Array without blank text values.

Использование

exclude_blank( $input ): array;
$input(массив) (обязательный)
The array.

Код exclude_blank() CF7 6.2.4.1

function exclude_blank(array $input): array
{
    $output = [];

    foreach ($input as $key => $item) {
        if (is_array($item)) {
            $item = exclude_blank($item);

            if (!empty($item)) {
                $output[$key] = $item;
            }
        } elseif (isset($item)) {
            if ("" !== $item) {
                $output[$key] = $item;
            }
        }
    }

    return $output;
}