Automattic\WooCommerce\Utilities

ArrayUtil::is_truthy()public staticWC 1.0

Checks if a given key exists in an array and its value can be evaluated as 'true'.

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

Хуков нет.

Возвращает

true|false. True if the key exists in the array and the value can be evaluated as 'true'.

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

$result = ArrayUtil::is_truthy( $items, $key );
$items(массив) (обязательный)
The array to check.
$key(строка) (обязательный)
The key for the value to check.

Код ArrayUtil::is_truthy() WC 9.5.1

public static function is_truthy( array $items, string $key ) {
	return isset( $items[ $key ] ) && $items[ $key ];
}