lp__array_key_value( $key, $array, $default = null )

This function allows you to retrieve the value from an array based on a given key. If the key exists in the array, the corresponding value is returned; otherwise, the default value is returned.

Plugin

Namespace

Launchpad

Parameters

int | string

$key

The array index or key.

array

$array

The array object.

mixed

$default

Default value to return if the key does not exist (default: null).

Return

mixed

The value corresponding to the key, or the default value if the key does not exist.

Source

File: \includes\lp-utility-functions.php

function lp__array_key_value( $key, $array, $default = null ) {
    return isset($array[$key]) ? $array[$key] : $default;
}

Related

Used to check if a given string is a serialized value.

Used to insert a value or an array into an array before or after a specified identifier.

Used to checks if an array is associative.