Difference between revisions of "ARRAY()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | customer = array(" | + | customer = array("custname" => "A Buyer Ltd.", ; |
"currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; | "currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; | ||
"orderitems" => array("10 reams A4 paper","500 business cards",; | "orderitems" => array("10 reams A4 paper","500 business cards",; | ||
Line 26: | Line 26: | ||
------------------------ | ------------------------ | ||
CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) | CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) | ||
− | . | + | .CUSTNAME Character 'A Buyer Ltd.' |
.CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) | .CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) | ||
.ORD_ID Character '00001' | .ORD_ID Character '00001' |
Revision as of 17:07, 4 November 2009
Purpose
Function to create a dynamic array
Syntax
ARRAY(<element value> | <element name> => <element value> [,...])
See Also
AADD(), AAVERAGE(), ABROWSE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DECLARE, DIMENSION, GATHER, LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER, SET EXACT
Description
The ARRAY() function is used to create a dynamic array. Elements are declared as a comma-separated list. Elements can be values only, <element value>, in which case they are given an automatically generated name: 00000001, 00000002 ... Element names can be specified using the <element name> => <element value> syntax. Multi-dimensional arrays can be created by using the ARRAY() function in the <element value> definition.
Example
customer = array("custname" => "A Buyer Ltd.", ; "currentorder" => array("ord_id" => "00001", "ord_date" => date(),"ord_total" => 1599,; "orderitems" => array("10 reams A4 paper","500 business cards",; "500 black ballpoint pens"))) display memory Memory Variables: ------------------------ CUSTOMER Dynamic array (refptr ARRAY, refcnt 1) .CUSTNAME Character 'A Buyer Ltd.' .CURRENTORDER Dynamic array (refptr ARRAY, refcnt 0) .ORD_ID Character '00001' .ORD_DATE Date 11/04/2009 .ORD_TOTAL Numeric 1599 (1599.000000000) .ORDERITEMS Dynamic array (refptr ARRAY, refcnt 0) .00000001 Character '10 reams A4 paper' .00000002 Character '500 business cards' .00000003 Character '500 black ballpoint pens' Total of 10 variables defined and 784 bytes used.
Products
Recital, Recital Server