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

# array:diff — Array difference

ARRAY:DIFF generates the symmetric difference of two arrays by merging those items of both arrays that do not exist within both arrays together, 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 | Difference 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>
	<item key="sj">Steve Jobs</item>
</array>

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

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

<!-- Bill Gates and Larry Ellison are competitors! -->
```

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

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

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

<!-- Bill Gates and Larry Ellison are competitors! -->
```
