WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Utilities

ArrayUtil::get_value_or_default() public WC 1.0

Gets the value for a given key from an array, or a default value if the key doesn't exist in the array.

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

No Hooks.

Return

Mixed|null. The value for the key, or the default value passed.

Usage

$result = ArrayUtil::get_value_or_default( $array, $key, $default );
$array(array) (required)
The array to get the value from.
$key(string) (required)
The key to use to retrieve the value.
$default(null)
The default value to return if the key doesn't exist in the array.
Default: null

Code of ArrayUtil::get_value_or_default() WC 5.9.0

public static function get_value_or_default( array $array, string $key, $default = null ) {
	return isset( $array[ $key ] ) ? $array[ $key ] : $default;
}