Skip to main content

allocate

Discworld driver help

allocate

Name

allocate() - allocate an array

Synopsis

varargs mixed *allocate( int size, mixed fill );

Description

Allocate an array of <size> elements. The number of elements must be >= 0 and not bigger than a system maximum (usually ~10000). If 'fill' is not given, all elements are initialized to 0. If 'fill' is a function, the function will be evaluated for each member of the array, and filled with the result. The function is passed the index of the member in question, starting from 0. If 'fill' is not a function, the resulting array will be an array of 'size' copies of 'fill'.

See also

sizeof(), allocate_mapping()