Tribe__Tickets_Plus__Meta__Storage::remove_empty_values_recursive( array $input )

Recursively Process Array to Remove Empty Values, but Keep 0


Parameters

$input

(array) (Required) a multidimensional array of attendee meta


Top ↑

Return

(array) a multidimensional array of attendee meta with no empty values


Top ↑

Source

File: src/Tribe/Meta/Storage.php

	public function remove_empty_values_recursive( $input ) {

		foreach ( $input as &$value ) {
			if ( is_array( $value ) ) {
				$value = $this->remove_empty_values_recursive( $value );
			}
		}

		// reset array for current to work correctly
		reset( $input );
		if ( is_array( current( $input ) ) ) {
			// if current item is an array return it to prevent notices of string to array
			return array_filter( $input );
		}

		// remove empty values, but keep 0 as a value
		return array_filter( $input, 'strlen' );
	}

Top ↑

Changelog

Changelog
Version Description
4.10.4 Introduced.