Push onto array
XML
<array:push var="var">
string
</array:push>
<array:push /> pushes a value onto the end of an array.
<array:push /> will implicitly generate a consecutive numeric key.
These three statements are semantically equivalent:
XML
<array:push var="var">value</array:push>
<set var="var[]">value</set>
Attention:
ARRAY:PUSH is destructive, in the sense that it modifies the array in-place. It preserves the key and value associations of the array.
Attributes
| Name | Type | Description | Defined By |
|---|---|---|---|
| var | var | Variable name | array:push |
Results
| Binding | Type | Predicate |
|---|---|---|
| var | array | no-result-propagation |
Examples
XML
<array var="names">
<item>Bill Gates</item>
</array>
<array:push var="names">Steve Jobs</array:push>
<output>$names[0] and $names[1] are competitors!</output>
<!-- Bill Gates and Steve Jobs are competitors! -->