$firstArray = array('apple', 'banana', 'cherry'); $secondArray = array('banana', 'date'); $mergedArray = CRM_Utils_Array::crm_array_merge_recursiveDistinct($firstArray, $secondArray); // Output: Array ( [0] => apple [1] => banana [2] => cherry [3] => date )
$nestedArray = array('fruit' => array('apple' => array('color' => 'red'))); $value = CRM_Utils_Array::crm_array_nested_array_value($nestedArray, 'fruit.apple.color'); // Output: red
$firstArray = array('apple', 'banana', 'cherry'); $secondArray = array('date', 'elderberry'); $mergedArray = CRM_Utils_Array::crm_array_merge($firstArray, $secondArray); // Output: Array ( [0] => apple [1] => banana [2] => cherry [3] => date [4] => elderberry )Overall, CRM_Utils_Array provides a useful set of functions for working with arrays in PHP, particularly in the context of CiviCRM.