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
|
edit
Structure from which to extract a list of keys Alias: structure, object |
Usage Notes
editFor unsorted structs, Adobe returns a text sorted Array of keys, for performance reasons, Lucee simply returns the raw sort order
Examples
editUnordered 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 open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)