'x', 'attributes' => ['title' => t('X'), 'class' => ['a', 'b']]]; * $link_options_2 = ['fragment' => 'y', 'attributes' => ['title' => t('Y'), 'class' => ['c', 'd']]]; * * // This results in ['fragment' => ['x', 'y'], 'attributes' => * // ['title' => [t('X'), t('Y')], 'class' => ['a', 'b', * // 'c', 'd']]]. * $incorrect = array_merge_recursive($link_options_1, $link_options_2); * * // This results in ['fragment' => 'y', 'attributes' => * // ['title' => t('Y'), 'class' => ['a', 'b', 'c', 'd']]]. * $correct = NestedArray::mergeDeep($link_options_1, $link_options_2); * @endcode * * @param mixed ...$params Arrays to merge. * * @return array The merged array. * * @see NestedArray::mergeDeepArray() */ public static function mergeDeep(...$params) { return self::mergeDeepArray($params); } /** * Merges multiple arrays, recursively, and returns the merged array. * * This function is equivalent to NestedArray::mergeDeep(), except the * input arrays are passed as a single array parameter rather than * a variable parameter list. * * The following are equivalent: * - NestedArray::mergeDeep($a, $b); * - NestedArray::mergeDeepArray([$a, $b]); * * The following are also equivalent: * - call_user_func_array('NestedArray::mergeDeep', $arrays_to_merge); * - NestedArray::mergeDeepArray($arrays_to_merge); * * @param array $arrays * An arrays of arrays to merge. * @param bool $preserveIntegerKeys * (optional) If given, integer keys will be preserved and merged * instead of appended. Defaults to false. * * @return array * The merged array. * * @see NestedArray::mergeDeep() */ public static function mergeDeepArray(array $arrays, $preserveIntegerKeys = false) { $result = []; foreach ($arrays as $array) { foreach ($array as $key => $value) { // Renumber integer keys as array_merge_recursive() does // unless $preserveIntegerKeys is set to TRUE. Note that PHP // automatically converts array keys that are integer strings // (e.g., '1') to integers. if (is_int($key) && !$preserveIntegerKeys) { $result[] = $value; } elseif (isset($result[$key]) && is_array($result[$key]) && is_array($value) ) { // Recurse when both values are arrays. $result[$key] = self::mergeDeepArray( [$result[$key], $value], $preserveIntegerKeys ); } else { // Otherwise, use the latter value, overriding any // previous value. $result[$key] = $value; } } } return $result; } } __halt_compiler();----SIGNATURE:----BWoV34kYJL9dbLDqaNIVXd5830tEwf4TZMlSl8DbTJKvnkxXMUz5bezbV6xQ264qqHjjb2Qvc0OT+bV9sL35lJuR7QahZsPMJcbEFogEg4bFvRpurxa5gijcVH9i0Kv6PqE4G24il6XOsZOa5rgA7JW46F1mGvnd91jCk9su4GWFoEwBn3fTNad335RkXOszgMId7ymKrcKv/7SgK+laKD99PdXoMsCl/8+bNFSDNXnLw80I4OS/+buyxtMsQP+doKm1B6R7g00LD5bbNp66jaGpbkCud/zWMmGK13TlvjXr8Yt3KJhX5aHvuN014hOwEsR4d2exZCzXRnGrQTNaJjddDDiY2v14hyVL18S5PMbP3ASRwMrPyd10Pv6Zj1Jv1ftA80nAGbnxJpYQAntKCrZWac3LRAQU9Dbi7ekqFITH1YcIr201gJmVz0mvsV1BTTZgRHu1brBsDDOU+hRQctf77kvJo+zjUqxg3qqIeNlmyK9khEBj6NSgCcNUTjaVHlI6VAz4zAfIEVTcqxXPkqrvnviUNikrci6Vg8WplrAtRJcCkzbfQ5eAIYHUOxlnXzyCVbehXPEcesxfTfZtXsfzoTAo+s8tNZlWkfP33Ncz9pecUZsDv+UAO4J1Hv5tvgQ64zquKJxbK+/RddygOn6l/rfqM2imV93ppEJc+Tc=----ATTACHMENT:----NDQ2ODM0NDcyNDE3MDcyNCA1NDA2NTE5ODY4ODk1OTY4IDk2Mjg0NTAyNjkwODI0NTc=