Merges two sets of changes.

@param array $left
@param array $right

@return array
771548
protected function mergeChangesArrays($left, $right)
	{
		$return = $left;

		foreach ($right as $type => $changes)
		{
			if (isset($left[$type]))
			{
				$return[$type] = array_merge($right[$type], $left[$type]);
			}
			else
			{
				$return[$type] = $changes;
			}
		}

		return $return;
	}
330642
public static function merge(): array
    {
        $args = func_get_args();
        $array = array_shift($args);

        while (! empty($args)) {
            $next = array_shift($args);

            foreach ($next as $key => $value) {
                if (is_int($key)) {
                    if (isset($array[$key])) {
                        $array[] = $value;
                    } else {
                        $array[$key] = $value;
                    }
                } elseif (is_array($value) && isset($array[$key]) && is_array($array[$key])) {
                    $array[$key] = static::merge($array[$key], $value);
                } else {
                    $array[$key] = $value;
                }
            }
        }

        return $array;
    }
1113925
protected function addInlineCodeTags($left, $right)
	{
		$startPos = $left['pos'];
		$startLen = $left['len'] + $left['trimAfter'];
		$endPos   = $right['pos'] - $right['trimBefore'];
		$endLen   = $right['len'] + $right['trimBefore'];
		$this->parser->addTagPair('C', $startPos, $startLen, $endPos, $endLen);
		$this->text->overwrite($startPos, $endPos + $endLen - $startPos);
	}
143345
public function match(array $left, array $collected = []) {
        foreach ($this->children as $pattern) {
            list($m, $left, $collected) = $pattern->match($left, $collected);
        }
        return [true, $left, $collected];
    }
721523
protected function deepMerge($leftSide, $rightSide)
    {
        if (!is_array($rightSide)) {
            
            return $rightSide;
        }
        
        foreach ($rightSide as $k => $v) {
            // no conflict
            if (!array_key_exists($k, $leftSide)) {

                $leftSide[$k] = $v;
                continue;
            }
            
            $leftSide[$k] = $this->deepMerge($leftSide[$k], $v);
        }
        
        return $leftSide;
    }
726534
public static function merge(array $to, array $from)
    {
        $args = func_get_args();
        $res = array_shift($args);
        while (!empty($args)) {
            $next = array_shift($args);
            foreach ($next as $k => $v) {
                if (is_integer($k)) {
                    isset($res[$k]) ? $res[] = $v : $res[$k] = $v;
                } elseif (is_array($v) && isset($res[$k]) && is_array($res[$k])) {
                    $res[$k] = self::merge($res[$k], $v);
                } else {
                    $res[$k] = $v;
                }
            }
        }
        return $res;
    }
517008
protected function isArrayReference(array &$left, array &$right)
    {
        $id = uniqid('schemer-', true);
        $left[$id] = true;
        $isArrayReference = array_key_exists($id, $right);
        unset($left[$id]);

        return $isArrayReference;
    }
20787
def merge(left, right, merged):
    

    left_cursor, right_cursor = 0, 0
    while left_cursor < len(left) and right_cursor < len(right):
        # Sort each one and place into the result
        if left[left_cursor] <= right[right_cursor]:
            merged[left_cursor+right_cursor]=left[left_cursor]
            left_cursor += 1
        else:
            merged[left_cursor + right_cursor] = right[right_cursor]
            right_cursor += 1
    # Add the left overs if there's any left to the result
    for left_cursor in range(left_cursor, len(left)):
        merged[left_cursor + right_cursor] = left[left_cursor]
    # Add the left overs if there's any left to the result
    for right_cursor in range(right_cursor, len(right)):
        merged[left_cursor + right_cursor] = right[right_cursor]

    # Return result
    return merged
232236
protected function merge($a, $b)
    {
        if (!is_array($a)) {
            if (!is_array($b)) return [];
            return $b;
        }

        if (!is_array($b)) return $a;

        foreach($b as $k => $v) {
            if (!isset($a[$k])) {
                $a[$k] = $v;
                continue;
            }
            if (!is_array($v)) {
                if (!is_array($a[$k])) {
                    $a[$k] = $v;
                    continue;
                }
                $a[$k] = array_merge($a[$k], [$v]);
                foreach(array_keys($a[$k]) as $kk) {
                    if (is_numeric($kk)) {
                        $a[$k] = array_unique($a[$k]);
                        break;
                    }
                }
                continue;
            }
            $a[$k] = array_merge($a[$k], $b[$k]);
            foreach(array_keys($a[$k]) as $kk) {
                if (is_numeric($kk)) {
                    $a[$k] = array_unique($a[$k]);
                    break;
                }
            }
        }

        return $a;
    }
1040308
protected function opDivNumberNumber($left, $right)
    {
        if ($right[1] == 0) {
            return [Type::T_STRING, '', [$left[1] . $left[2] . '/' . $right[1] . $right[2]]];
        }

        return new Node\Number($left[1] / $right[1], $left[2]);
    }
469474
protected function arrayEquals(array $left, $right)
    {
        if (!is_array($right)) {
            return false;
        }
        if (array_keys($left) !== array_keys($right)) {
            return false;
        }

        foreach ($left as $key => $value) {
            if (!$this->valueEquals($value, $right[$key])) {
                return false;
            }
        }

        return true;
    }
167394
public function merge(self $other = null)
    {
        // Create new item
        $new = $this->copyChildless();

        // Add all children from this item
        foreach ($this->getChildren() as $child) {
            /* @var NavigationItem $child */
            $new->addChild($child->merge((null != $other) ? $other->findChildren($child) : null));
        }

        // Add all children from the other item
        if (null != $other) {
            foreach ($other->getChildren() as $child) {
                /** @var NavigationItem $child */
                if (!$new->find($child)) {
                    $new->addChild($child->merge($this->copyChildless()));
                }
            }
        }

        return $new;
    }
636869
protected function mergeOutput(array $left, array $right)
	{
		if (empty($left))
		{
			return $right;
		}

		if (empty($right))
		{
			return $left;
		}

		// Test whether we can merge the last expression on the left with the first expression on
		// the right
		$k = count($left) - 1;

		if (substr($left[$k], -1) === "'" && $right[0][0] === "'")
		{
			$right[0] = substr($left[$k], 0, -1) . substr($right[0], 1);
			unset($left[$k]);
		}

		return array_merge($left, $right);
	}
363572
public static function merge($one, $two) 
    {
        $elements = $one->elements;
        foreach($two->elements as $node) {
            $exists = false;
            foreach($elements as $node2) {
                if ($node2->isSameNode($node)) {
                    $exists = true;
                }
            }
            if (! $exists) {
                $elements[] = $node;
            }
        }
        return $elements;
        //        $one = $one->newInstance();
        //        $one->elements = $elements;
        //        return $one;
    }
236689
public function merge(File $other): self
    {
        $new = new static($this->filename);
        $new->issues = array_merge($this->issues, $other->issues);
        return $new;
    }
620538
private function merge(array $merged, array $array)
    {
        foreach ($array as $key => $value) {
            if (is_array($value) && isset ($merged[$key]) && is_array($merged[$key])) {
                $merged[$key] = $this->merge($merged[$key], $value);
            } else {
                $merged[$key] = $value;
            }
        }

        return $merged;
    }
587315
protected function mul($left, $right, $precision)
    {
        if (is_null($precision)) return $left * $right;
        return floatval(\bcmul($left, $right, $precision));
    }