This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
uphp:functions:indexed_array [2017/03/28 17:34] jeff |
uphp:functions:indexed_array [2021/09/13 05:57] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ======indexed_array====== | ======indexed_array====== | ||
| + | |||
| < | < | ||
| - | Create an array of a specific type and size | + | Create an < |
| ====Description==== | ====Description==== | ||
| - | <well size=" | + | |
| - | <span style=" | + | <well size=" |
| - | < | + | <span style=" |
| - | <span style=" | + | <span style=" |
| - | <span style=" | + | <span style=" |
| - | <span style=" | + | <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. | + | Create an indexed |
| ====Parameters==== | ====Parameters==== | ||
| - | < | + | |
| + | <html><b>< | ||
| * Type 1: Array of bytes | * Type 1: Array of bytes | ||
| * Type 2: Array of short integers (16 bits) | * Type 2: Array of short integers (16 bits) | ||
| Line 24: | Line 27: | ||
| * Type 4: Array of floating point numbers | * Type 4: Array of floating point numbers | ||
| - | < | + | <html><b>< |
| - | ====Return | + | ====Return |
| - | Indexed array | + | |
| + | Indexed | ||
| ====Example==== | ====Example==== | ||
| + | |||
| <code php> | <code php> | ||
| <? | <? | ||
| Line 37: | Line 42: | ||
| ====Note==== | ====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. | 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==== | ====See Also==== | ||
| - | [[array()]] - Create an array, with optional values | + | |
| + | [[array()]] - Create an < | ||
| [[uphp: | [[uphp: | ||