1.0 1.1 1.2 1.3

Creates a PHP array with the given input

array(array $rest)
  • rest: any number of values of variables, either with named parameters to build an associative array or without for an auto-indexed array


Example #1: Associative Array Example

{assign array(name="Bob" gender="male") user}
{$} is {$user.gender}

The above example will output:

Bob is male

Example #2: Auto-indexed Array Examples

{assign array("Bob" "John") users}
First user is : {$users.0}
User list : {foreach $users user}{$user} {/foreach}

The above example will output:

First user is : Bob
User list : Bob John