User Tools

Site Tools


uphp:functions:indexed_array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

uphp:functions:indexed_array [2017/03/27 19:43]
jeff created
uphp:functions:indexed_array [2021/09/13 05:57]
Line 1: Line 1:
-======indexed_array====== 
-<badge>WMPRO, WMMINI FW >= 1.898</badge> <badge>WMMEGA FW >= 2.0</badge> 
- 
-Create an array of a specific type and size 
- 
-====Description==== 
-<well size="sm"><html><span style="font-size:125%;color:green;">array 
-<span style="color:black;"></html>[[indexed_array]] 
-<html>( 
-<span style="color:green;">int 
-<span style="color:blue;">$type<span style="color:black;">, 
-<span style="color:green;">int 
-<span style="color:blue;">$size 
-<span style="color:black;">) 
-</html></well> 
- 
-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==== 
-<html><span style="color:blue;"><b>type</b><span style="color:black;"></html>:  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 
- 
-<html><span style="color:blue;"><b>size</b><span style="color:black;"></html>:  The number of elements in the array 
- 
-====Return Value==== 
-Indexed array 
- 
-====Example==== 
-<code php> 
-<?  
-  $arr=indexed_array(1,100); // create an array of 100 bytes 
-?> 
-</code> 
- 
-====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=<html><span style="color:blue;">$size<span style="color:black;"></html>-1. 
- 
-====See Also==== 
-[[array()]] - Create an array with values 
- 
-[[uphp:variables|uPHP Variable Types and Limits]] 
  
uphp/functions/indexed_array.txt · Last modified: 2021/09/13 05:57 (external edit)