---
title: "Inspection"
description: "Commands for checking array length, key existence, and random access."
canonical_url: "https://www.zeyos.com/ixml/ixml-guide/data-types/arrays/inspection"
markdown_url: "https://www.zeyos.com/ai/guide/ixml/ixml-guide/data-types/arrays/inspection.md"
section: "ixml-guide"
authority: "guide"
language: "en"
source_repository: "zeyos/guide"
source_path: "docs/ixml/02-data-types/arrays/inspection.md"
source_revision: "cce886a8da98cd124ee3644711085bbdcf1a87ce"
---

# Array Inspection

## `array:length` — Get array length

[Full reference →](https://www.zeyos.com/ixml/ref/array-length)

Returns the number of items in an array.

### Syntax

```xml
<array:length var="arrayName" var_result="resultVar" />
```

### Example

```xml
<output>Count: <array:length var="names" /></output>
```

---

## `array:keyexists` — Check if key exists

[Full reference →](https://www.zeyos.com/ixml/ref/array-keyexists)

Checks whether a specific key exists within an array.

### Syntax

```xml
<array:keyexists var="arrayName" var_result="resultVar">keyToCheck</array:keyexists>
```

### Example

```xml
<array:keyexists var="names" var_result="exists">sj</array:keyexists>
```

---

## `array:valueexists` — Check if value exists

[Full reference →](https://www.zeyos.com/ixml/ref/array-valueexists)

Checks whether a specific value exists within an array.

### Syntax

```xml
<array:valueexists var="arrayName" var_result="resultVar">valueToFind</array:valueexists>
```

---

## `array:pos` — Find position of value

[Full reference →](https://www.zeyos.com/ixml/ref/array-pos)

Searches an array for a value and returns the **key** of the matching item.

### Syntax

```xml
<array:pos var="arrayName" var_result="resultVar">valueToFind</array:pos>
```

### Attributes

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `var` | var | Yes | — | The array to search. |
| `type` | type | No | `first` | `first` or `last`. |
| `offset` | int | No | — | Items to skip. |

---

## `array:first` — Get first item

[Full reference →](https://www.zeyos.com/ixml/ref/array-first)

Returns the first item of an array (key and value).

### Syntax

```xml
<array:first var="arrayName" var_key="keyVar" var_value="valueVar" />
```

---

## `array:last` — Get last item

[Full reference →](https://www.zeyos.com/ixml/ref/array-last)

Returns the last item of an array.

### Syntax

```xml
<array:last var="arrayName" var_key="keyVar" var_value="valueVar" />
```

---

## `array:rand` — Get random item

[Full reference →](https://www.zeyos.com/ixml/ref/array-rand)

Returns a randomly selected item.

### Syntax

```xml
<array:rand var="arrayName" var_key="keyVar" var_value="valueVar" />
```
