if(CRM_Utils_Array::value('key', $array)) { // key exists in $array }
CRM_Utils_Array::setValue($array, 'key', 'value');
$value = CRM_Utils_Array::value('key', $array, 'default_value');This code snippet gets the value of the key 'key' from the array $array. If the key doesn't exist, it returns the default value 'default_value'. The CRM_Utils_Array library is part of the CiviCRM package/library. CiviCRM is an open-source constituent relationship management (CRM) system that is used by nonprofit organizations and advocacy groups.