struct.keyArray()

Returns an array of the keys from a structure; if structure does not exist, CFML throws an exception.

struct.keyArray( )

Returns: Array

This function does not take any arguments.

Examples

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow",
	bird: "chirp"
};
// animals.keyArray()
animalKeyArray = animals.keyArray();
// Show results of animalKeyArray
// ["bird","cat","cow","pig"]
dump(animalkeyarray);
for (animal in animalKeyArray) {
	// Show value of animal in animals
	Dump(
		label: "Value of " & animal,
		var: animals[animal]
	);
}

See also