You are here

private function CourseHandler::optionsMerge in Course 7

Same name and namespace in other branches
  1. 6 includes/course.core.inc \CourseHandler::optionsMerge()
  2. 7.2 includes/CourseHandler.inc \CourseHandler::optionsMerge()

Merge arrays with replace, not append.

See also

http://www.php.net/manual/en/function.array-merge-recursive.php#102379

1 call to CourseHandler::optionsMerge()
CourseHandler::addOptions in includes/CourseHandler.inc
Merge an array of options onto the existing options.

File

includes/CourseHandler.inc, line 121

Class

CourseHandler
Master class for anything Course related.

Code

private function optionsMerge($Arr1, $Arr2) {
  foreach ($Arr2 as $key => $Value) {
    if (array_key_exists($key, $Arr1) && is_array($Value)) {
      $Arr1[$key] = $this
        ->optionsMerge($Arr1[$key], $Arr2[$key]);
    }
    else {
      $Arr1[$key] = $Value;
    }
  }
  return $Arr1;
}