---
title: "array:union — Array union"
description: "iXML command array:union: Array union."
canonical_url: "https://www.zeyos.com/ixml/ref/array-union"
markdown_url: "https://www.zeyos.com/ai/guide/ixml/ref/array-union.md"
section: "ixml-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/ixmldoc.xml"
source_sha256: "a23f04e6a98628ca3c273c3b8dd2c33c034cfda3e0f00478d8793074fd2f70dd"
---

# array:union — Array union

ARRAY:UNION generates the union of two arrays by merging the items of an array with those items of the set array that do not exist in the original array, whereas duplicated non-numeric keys are overwritten while items with numeric keys are appended.

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| var | var |  | Variable name |
| var_set | var |  | Set variable name |
| var_result | var | (destructive on 'var') | Result variable name |
| type | type | values | Union type |

#### Possible values
Possible values for `type`:
- keys — By keys
- values — By values


### Children
- (none)

### Parents
- (not restricted in the reference)

### Result
- binding: var|var_result; type: array; predicate: no-result-propagation

### Examples

```xml
<array var="names">
	<item key="bg">Bill Gates</item>
</array>

<array var="union">
	<item key="sj">Steve Jobs</item>
	<item key="le">Larry Ellison</item>
</array>

<array:union var="names" var_set="union" type="keys"/>
<output>$names.bg and $names.sj are competitors!</output>

<!-- Bill Gates and Steve Jobs are competitors! -->
```

```xml
<array var="names">
	<item>Bill Gates</item>
</array>

<array var="union">
	<item>Steve Jobs</item>
	<item>Larry Ellison</item>
</array>

<array:union var="names" var_set="union" type="values"/>
<output>$names[0] and $names[1] are competitors!</output>

<!-- Bill Gates and Steve Jobs are competitors! -->
```
