How to get an array of keys from a structure in ColdFusion

StructKeyArray() - get an array of keys from a structure

StructKeyArray.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructKeyArray function example: how to get an array of keys from a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructKeyArray Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LightCoral">
<cfset Color.Value="##F08080">
<cfdump var="#Color#" label="Color">

<br />
<cfset ColorKeyArray=StructKeyArray(Color)>
<cfdump var="#ColorKeyArray#" label="Color[Structure Key array]">

</body>
</html>





More ColdFusion examples