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/04/06 12:05]
jeff
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 <html><b><span style="color:green">array<span style="color:black"></b></html> 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 <html><b><span style="color:green">array<span style="color:black"></b></html> 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><b><span style="color:blue">$type<span style="color:black"></b></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><b><span style="color:blue">$size<span style="color:black"></b></html>:  The number of elements in the <html><b><span style="color:green">array<span style="color:black"></b></html> 
- 
-====Return Value==== 
- 
-Indexed <html><b><span style="color:green">array<span style="color:black"></b></html> 
- 
-====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=$size-1. 
- 
-====See Also==== 
- 
-[[array()]] - Create an <html><b><span style="color:green">array<span style="color:black"></b></html>, with optional values 
- 
-[[uphp:variables|uPHP Variable Types and Limits]] 
  
uphp/functions/indexed_array.txt · Last modified: 2021/09/13 05:57 (external edit)