Also, if you try doing this

a = ArrayNew(1);
a[1].someKey = "some value";

you'll get an error.

a = ArrayNew(1);
a[1] = StructNew();
a[1].someKey = "some value";

Will work.

Ade

-----Original Message-----
From: Jared Rypka-Hauer - CMG, LLC [mailto:[EMAIL PROTECTED]
Sent: 14 January 2005 19:17
To: CF-Talk
Subject: Re: Multivalued Array help


I was recently testing something and made an interesting discovery...

<cfscript>
  thisVar.testStruct.myVal = "some value";
</cfscript>

Actually works... without a structNew() call to create it.

So... new question... do we go ahead and imply a struct simply by
syntax, or do we, for the sake of protocol and readability, insist on
an explicit strucNew() call?

Personally, I'm for dropping the extra operation and implicity
creating a struct.

Anybody?

Laterz,
J

-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://cfobjective.blogspot.com

On Fri, 14 Jan 2005 13:58:04 -0500, Ben Doom <[EMAIL PROTECTED]> wrote:
> Associative arrays in PHP are basically the equivalent of structures in
> CF.  So, in CFSCRIPT...
> 
> item = structnew();
> item.level = "level 12";
> item.ecs = "something else";
> // alternate syntax
> item["dn"] = "third data";
> 
> and so forth.
> 
> --Ben
> 
> Charles Heizer wrote:
> > Hello,
> > If I wanted to do a multi-valued array in php I would initialize the
> > array like this, how would I do this in ColdFusion?
> >
> > Thanks,
> > - Charles
> >
> > PHP Example --
> > $item = array(
> >                 'level'=> $level,
> >                 'ecs' => $expanded,
> >                 'dn'=> $dn,
> >                 'rdn'=> $rdn[0],
> >                 'icon'=> $icon,
> >       );
-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.2 - Release Date: 28/01/2005


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192480
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to