A Slice sequence maps to a native PHP indexed array. The first element of the Slice sequence is contained at index 0 (zero) of the PHP array, followed by the remaining elements in ascending index order.
Consider this example:
{zcode:slice} sequence<Fruit> FruitPlatter; {zcode} |
You can create an instance of FruitPlatter
as shown below:
{zcode:php} // Make a small platter with one Apple and one Orange // $platter = array(Fruit::Apple, Fruit::Orange); {zcode} |
The Ice run time validates the elements of an array to ensure that they are compatible with the declared type and raises InvalidArgumentException
if an incompatible type is encountered.