array_key_exists() in template


Well-known member
Inside templates, we have a way to check if values exist:

 <xen:if is="in_array({$visitor.user_id}, array('1', '2', '3'))">your id is 1 2 or 3 ...</xen:if>
but to find if an array key exists is there a similar way?

I guess usually you could use:

<xen:if is="{$someVaraible.myKey}"> this key this exists </xen:if>

But in my case, I need to check if an ip exists in a key, obviously in this case the above wont work, since the key contains decimals:


currently I'm thinking of looping to check:
   <xen:foreach loop="$someVaraible.myKey" key="$botIp" value="$botTime">
      <xen:if is="{$botIp}==''">Yay, I found my key</xen:if>
Is there a better (performing and cleaner) way to check to see if this key exists (it's been a while since I've looked at xen template coding, so I'm a bit rusty).

I was hoping something like this might work:

<xen:if is="{$someVaraible['myKey']}">