Method enumerate()
- Method
enumerate
array(int) enumerate(intn)
arrayenumerate(intn,void|mixedstep,void|mixedstart,void|function(:void)operator)- Description
Create an array with an enumeration, useful for initializing arrays or as first argument to map() or
foreach().The defaults are:
step= 1,start= 0,operator= `+Advanced use
The resulting array is calculated like this:
array enumerate(int n, mixed step, mixed start, function operator) { array res = allocate(n); for (int i=0; i < n; i++) { res[i] = start; start = operator(start, step); } return res; }- See also
map(),
foreach()