Automattic\WooCommerce\Utilities

ArrayUtil::unique_truthy_values │ public static │ WC 11.3.0

Get the unique truthy values of an array, reindexed.

Метод класса: ArrayUtil{}

Хуков нет.

Возвращает

array. The unique truthy values, with sequential integer keys.

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

$result = ArrayUtil::unique_truthy_values( $items ): array;
$items(массив) (обязательный)
The array to process.

Список изменений

С версии 11.3.0 Введена.

Код ArrayUtil::unique_truthy_values() WC 11.3.0

public static function unique_truthy_values( array $items ): array {
	return array_values( array_unique( array_filter( $items ) ) );
}