StructKeyArray()
Returns an array of the keys from a structure; if structure does not exist, CFML throws an exception.
StructKeyArray( struct=struct );
Returns: Array
Argument | Description |
---|---|
struct
struct,
required
|
Structure from which to extract a list of keys Alias: structure, object |
Usage Notes
For unsorted structs, Adobe returns a text sorted Array of keys, for performance reasons, Lucee simply returns the raw sort order
Examples
Unordered Structs (default)
animals = {
cow: "moo",
pig: "oink",
cat: "meow",
bird: "chirp"
};
dump(StructKeyArray(animals));
Ordered Structs
animals = [
cow: "moo",
pig: "oink",
cat: "meow",
bird: "chirp"
];
dump(StructKeyArray(animals));
See also
- Structures
- StructKeyList()
- struct.keyArray()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)