Zum Hauptinhalt springen

Build array

Anatomy

<array var="var" key="(next consecutive numeric key)">
ixml
</array>

Description: ARRAY builds an array with associated key and value pairs. It may be deeply nested in order to build a multidimensional array.

If the key is omitted within ARRAY or ITEM, a consecutive numeric key will implicitly be generated.

Attributes

NameTypeDescriptionDefined By
varvarResult variable name array
keystringKey array

Results:

BindingTypePredicate
vararrayno-result-propagation

Examples

Array with explicit keys

<array var="names">
<item key="bg">Bill Gates</item>
<item key="sj">Steve Jobs</item>
</array>

<output>$names.bg and $names.sj are competitors!</output>

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

Array with implicit numeric keys

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

<output>$names[0] and $names[1] are competitors!</output>

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