The in_array method can be used to validate is a value exist in an array. The result is true if the key is found and false if the key does not exist.

in_array

{{"text"|in_array:$array}}

Examples

Examples

{{$array = ["Banana", "Apple", "Pear"]}}


{{if "Banana"|in_array:$array}}
  We still have banana's available!
{{else}}
   Sadly we don't have any banana's left...
{{/if}}

Outcome:

We still have banana's available!