This shows you the differences between two versions of the page.
uphp:functions:indexed_array [2017/03/28 20:13] jeff |
uphp:functions:indexed_array [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======indexed_array====== | ||
- | < | ||
- | |||
- | Create an array of a specific type and size | ||
- | |||
- | ====Description==== | ||
- | <well size=" | ||
- | <span style=" | ||
- | < | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | |||
- | 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: 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 | ||
- | |||
- | < | ||
- | |||
- | ====Return Value==== | ||
- | Indexed array | ||
- | |||
- | ====Example==== | ||
- | <code php> | ||
- | <? | ||
- | $arr=indexed_array(1, | ||
- | ?> | ||
- | </ | ||
- | |||
- | ====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: | ||