code: function masktree_merge($masktree1, $masktree2, $maskname)
  	{
  		$merged = array_merge($masktree1, $masktree2);
  		if (count($merged) < count($masktree1) + count($masktree2)) {
  			$keys1 = array_keys($masktree1);
  			$keys2 = array_keys($masktree2);
  			$keysm = array_merge($keys1, $keys2);
  			$keysc = array_count_values($keysm);
  			foreach ($keysc as $keyn => $keyc) {
  				if ($keyc > 1) {
  					if ($keyn == '0reduce') {
  						$this->error(6, 49, 'reduce element already used');
  					} elseif ($keyn != '0include') {
  						$this->error(16, 60, "template $keyn already defined in <b>$maskname</b>");
  					}
  				}
  			}
  		}
  		return $merged;
  	}
docs: Merge two template trees