From 4f24efcce48becb109212f1f5bf62e9a82e8dd62 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 23 Jul 2015 03:22:35 -0700 Subject: [PATCH] CRM_Utils_Array::extend() --- CRM/Utils/Array.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; + } + } + } + } -- 2.25.1