Name

Array.resize — find the length of an array

Synopsis

void Array.resize ( length,  
  init);  
int   length;
mixed   init;

Description

Resizes the array in place. The array object will be resized so that it contains length elements. If length is greater than the array's current length then the new elements added will be initialised with init, which must be of the correct data type for the array object.

Example 58. Array.resize Example

int[] arraycopy(int[] src)
{
    int[] a;
    a.resize(src.length(), 0);

    for(int i = 0; i < src.length(); i++)
        a[i] = src[i];
        
    return a;
}