Skip to main content

Array Inspection

array:length — Get array length

Full reference →

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 →

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 →

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 →

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

NameTypeRequiredDefaultDescription
varvarYesThe array to search.
typetypeNofirstfirst or last.
offsetintNoItems to skip.

array:first — Get first item

Full reference →

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 →

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 →

Returns a randomly selected item.

Syntax

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