You are here

function mediafront_array_replace_recursive in MediaFront 7

Same name and namespace in other branches
  1. 6.2 mediafront.module \mediafront_array_replace_recursive()
  2. 6 mediafront.module \mediafront_array_replace_recursive()

An implementation of "array_replace_recursive" that works for all PHP versions.

See http://php.mirror.camelnetwork.com/manual/kr/function.array-replace-recu... for more info.

1 call to mediafront_array_replace_recursive()
mediafront_playlist_node_merge in ./mediafront.module
Merge the node additions.

File

./mediafront.module, line 391

Code

function mediafront_array_replace_recursive($toArray, $fromArray) {

  // Loop through array key/value pairs
  foreach ($fromArray as $key => $value) {

    // Assign the value to the toArray.
    if (is_array($toArray)) {
      $toArray[$key] = is_array($value) || is_object($value) ? mediafront_array_replace_recursive($toArray[$key], $value) : $value;
    }
    else {
      $toArray->{$key} = is_array($value) || is_object($value) ? mediafront_array_replace_recursive($toArray->{$key}, $value) : $value;
    }
  }

  // Return the joined array
  return $toArray;
}