public static function getArrayValueForKeyOrDefault(array &$array, string $key, $default, bool $ignoreCase = false, bool $deepSearchDotNotation = false)
    {
        $keyToCheck = $key;
        $arrayToCheck = &$array;
        
        if ($ignoreCase) {
            $keyToCheck = strtolower($keyToCheck);
            $arrayToCheck = array_change_key_case($arrayToCheck);
        }
        
        if (array_key_exists($keyToCheck, $arrayToCheck)) {
            return $arrayToCheck[$keyToCheck];
        }
        
        if (!$deepSearchDotNotation || strpos($keyToCheck, ".") === false) {
            return $default;
        }
        
        $keySeparated = explode('.', $keyToCheck);
        $checkOrReturn = $arrayToCheck;
        
        foreach ($keySeparated as $keyPart) {
            if (is_object($checkOrReturn)) {
                $checkOrReturn = ObjectUtils::getPropertyForKeyOrDefault($checkOrReturn, $keyPart, $default);
                continue;
            }
            
            if (!is_array($checkOrReturn) || !array_key_exists($keyPart, $checkOrReturn)) {
                $checkOrReturn = &$default;
                break;
            }
            
            $checkOrReturn = &$checkOrReturn[$keyPart];
        }
        
        return $checkOrReturn;
    }
public static function getArrayValueForKeyOrDefault(array &$array, string $key, $default, bool $ignoreCase = false, bool $deepSearchDotNotation = false)
    {
        $keyToCheck = $key;
        $arrayToCheck = &$array;
        
        if ($ignoreCase) {
            $keyToCheck = strtolower($keyToCheck);
            $arrayToCheck = array_change_key_case($arrayToCheck);
        }
        
        if (array_key_exists($keyToCheck, $arrayToCheck)) {
            return $arrayToCheck[$keyToCheck];
        }
        
        if (!$deepSearchDotNotation || strpos($keyToCheck, ".") === false) {
            return $default;
        }
        
        $keySeparated = explode('.', $keyToCheck);
        $checkOrReturn = $arrayToCheck;
        
        foreach ($keySeparated as $keyPart) {
            if (is_object($checkOrReturn)) {
                $checkOrReturn = ObjectUtils::getPropertyForKeyOrDefault($checkOrReturn, $keyPart, $default);
                continue;
            }
            
            if (!is_array($checkOrReturn) || !array_key_exists($keyPart, $checkOrReturn)) {
                $checkOrReturn = &$default;
                break;
            }
            
            $checkOrReturn = &$checkOrReturn[$keyPart];
        }
        
        return $checkOrReturn;
    }
public static function getArrayValueForKeyOrDefault ( array & $ array , string $ key , $ default , bool $ ignoreCase = false , bool $ deepSearchDotNotation = false ) { $ keyToCheck = $ key ; $ arrayToCheck = & $ array ; if ( $ ignoreCase ) { $ keyToCheck = strtolower ( $ keyToCheck ) ; $ arrayToCheck = array_change_key_case ( $ arrayToCheck ) ; } if ( array_key_exists ( $ keyToCheck , $ arrayToCheck ) ) { return $ arrayToCheck [ $ keyToCheck ] ; } if ( ! $ deepSearchDotNotation || strpos ( $ keyToCheck , "." ) === false ) { return $ default ; } $ keySeparated = explode ( '.' , $ keyToCheck ) ; $ checkOrReturn = $ arrayToCheck ; foreach ( $ keySeparated as $ keyPart ) { if ( is_object ( $ checkOrReturn ) ) { $ checkOrReturn = ObjectUtils :: getPropertyForKeyOrDefault ( $ checkOrReturn , $ keyPart , $ default ) ; continue ; } if ( ! is_array ( $ checkOrReturn ) || ! array_key_exists ( $ keyPart , $ checkOrReturn ) ) { $ checkOrReturn = & $ default ; break ; } $ checkOrReturn = & $ checkOrReturn [ $ keyPart ] ; } return $ checkOrReturn ; }
Get the value from an array for the given key.
Return a default value if the key could not be found.

@param array $array
The array to get the value from.

@param string $key
The key to get the value for.

@param mixed $default
Value to return if the key is not found in the array.

@param bool $ignoreCase
[optional]
Whether to treat lowercase and uppercase letters as equivalent during the search.

@param bool $deepSearchDotNotation
[optional]
Use $key as a detailed path specifier with path elements separated by a dot.
E.g: path.to.value will try to find $array['path']['to']['value'] in addition to $array['path.to.value'].

@return mixed Value from an array for the given key or default value if the key could not be found.
Get the value from an array for the given key . Return a default value if the key could not be found .