How to Configure a 2D Table

advertisements

I am having some problems setting up a 2d array in ColdFusion. I set my array using:

<cfset lang=ArrayNew(2)>
<csset lang["ch"]["dealer1"] = "代理 1">
<csset lang["en"]["dealer1"] = "Dealer 1">
.....

But when I dump the array, it is empty. Can anyone help? I don't want to use number to set my language.


Unlike PHP - from which I suspect you are coming - there is the appropriate difference between an array (ordered and indexed numerically) and a struct (indexed by an arbitrary key value).

So you want something like:

myStruct = {akey="some value", subStruct={someKey="another value"}}; //etc