Onetastic Macro Documentation >
>
>
Array Array
Creates an array with given elements or key/value pairs. Instead of this function the shorthand bracket notation can also be used. See examples below for more information.
Syntax
Array Array(Mixed elements...)
Parameters
- Mixed elements (optional)
- Elements in the array. No elements or several elements can be provided. Keys can be provided along with an element with arrow operator (=>).
Examples
Copied!
$array = Array()
$array = []
$array = Array(1, 2, 3)
$array = [1, 2, 3]
$page = GetCurrentPage()
$array = Array(1, "string", false, $page)
$array = [1, "string", false, $page]
$array = Array("name" => "Fred", "age" => 32, "gender" => "male")
$array = ["name" => "Fred", "age" => 32, "gender" => "male"]
$array = Array(Array(0, 1, 2), Array(3, 4, 5), Array(6, 7, 8))
$array = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
$element = $array[1][2]
|