indexed_array

WMPRO, WMMINI FW >= 1.898 WMMEGA FW >= 2.0

Create an array of a specific type and size

Description

array indexed_array ( int $type, int $size )

Create an indexed array with the specified type and number of elements. An indexed array is a more efficient way to store variables in memory if the size and data type is known beforehand. The array() function creates a hashed array, which consumes much more memory per element.

Parameters

$type: 1=byte, 2=short, 3=int, 4=float

  • Type 1: Array of bytes
  • Type 2: Array of short integers (16 bits)
  • Type 3: Array of 32 bit integers
  • Type 4: Array of floating point numbers

$size: The number of elements in the array

Return Values

Indexed array

Example

<? 
  $arr=indexed_array(1,100); // create an array of 100 bytes
?>

Note

There are no named keys in an indexed array, all elements are referenced by the index number. The first element is index=0, and the last element is index=$size-1.

See Also

array() - Create an array, with optional values

uPHP Variable Types and Limits