Table of Contents

array_resize

WMMEGA FW >= 2.1179 WM-M2 FW >= 3.1179

Resize an indexed array

Description

array_resize ( array $array, int $length )

Parameters

$array: An indexed array

$index: The number of elements to resize to. If this is larger than the current size, 0 values will be inserted at the end. If the value is smaller, the array will be chopped.

Return Values

none

Example

===Create an indexed array and resize it

<pre><?
 
  $arr=indexed_array(4,100);  // array of 100 floating point values
 
  // fill it up
  for ($i=0;$i<100;$i++) {
    $arr[$i]=$i;
  }
 
  print(sizeof($arr));
 
  array_resize($arr,50);
  print_r($arr);
 
  array_resize($arr,120);
  print_r($arr);
?></pre>

See Also

indexed_array() - Create an indexed array