From: Tim Otten Date: Thu, 23 Jul 2015 10:22:35 +0000 (-0700) Subject: CRM_Utils_Array::extend() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4f24efcce48becb109212f1f5bf62e9a82e8dd62;p=civicrm-core.git CRM_Utils_Array::extend() --- diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index a2d16088d8..9af358d6a8 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -904,4 +904,21 @@ class CRM_Utils_Array { return $result; } + /** + * Copy all properties of $other into $array (recursively). + * + * @param array|ArrayAccess $array + * @param array $other + */ + public static function extend(&$array, $other) { + foreach ($other as $key => $value) { + if (is_array($value)) { + self::extend($array[$key], $value); + } + else { + $array[$key] = $value; + } + } + } + }