Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active April 4, 2019 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/5b20fe32da06d783f6d8636abb92f0f8 to your computer and use it in GitHub Desktop.
Save JamoCA/5b20fe32da06d783f6d8636abb92f0f8 to your computer and use it in GitHub Desktop.
Comparison of StructKeyExists vs IsDefined for determining if a multi-level sub-key exists.
<!---
4/4/2019 Comparison of StructKeyExists vs IsDefined for determining if a multi-level sub-key exists.
https://gist.github.com/JamoCA/5b20fe32da06d783f6d8636abb92f0f8
Response to this: https://forums.adobe.com/message/11012233#11012233
Try it here: https://www.trycf.com/gist/5b20fe32da06d783f6d8636abb92f0f8
--->
<cfset Test = {
House = {
Address = {
Shipping = 1
}
}
}>
<cfoutput>
<h2>StructKeyExists(Test,'House.Address.Shipping')</h2>
#StructKeyExists(Test,'House.Address.Shipping')#
<h2>isDefined('Test.House.Address.Shipping')</h2>
#isDefined('Test.House.Address.Shipping')#
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment