Skip to content

Instantly share code, notes, and snippets.

@davejlong
Created November 16, 2010 19:32
Show Gist options
  • Save davejlong/702340 to your computer and use it in GitHub Desktop.
Save davejlong/702340 to your computer and use it in GitHub Desktop.
What is wrong here?
<cfset foo = arrayNew(1)>
<cfset foo[1] = 'bar' />
<cfset foo[2][1] = 'bar2' />
<cfdump var="#foo#" />
<cfset bar = arrayNew() />
<cfset bar[1][1] = 'foo' />
<cfset bar[2][2] = 'foo2' />
<cfdump var="#bar#" />
<!--- Create an array with 1 dimension --->
<cfset foo = arrayNew(1)>
<!--- Add a string value to the array --->
<cfset foo[1] = 'bar' />
<!--- Add a struct to the array with struct.1 = bar2 --->
<cfset foo[2][1] = 'bar2' />
<cfdump var="#foo#" />
<!--- Create an array (in Railo) with 1 dimension --->
<cfset bar = arrayNew() />
<!--- Add a struct to the array with struct.hello = foo --->
<cfset bar[1]['hello'] = 'foo' />
<cfdump var="#bar#" />
@gregmoser
Copy link

haha, oops... sorry. It just popped up on my github news feed, and yes you are right "People who develop on Adobe ColdFusion will quickly say that this snippet won't work."

Sorry for missing the point ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment