WordPress at Your Fingertips
function is not described


ArrayUtil::is_truthy() public WC 1.0

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

{} It's a method of the class: ArrayUtil{}

No Hooks.


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


$result = ArrayUtil::is_truthy( $array, $key );
$array(array) (required)
The array to check.
$key(string) (required)
The key for the value to check.

Code of ArrayUtil::is_truthy() WC 5.9.0

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