in()
Checks whether the evaluated value exists in a later set of evaluated values.
Syntax
in(VAL_EXPR, EXPR[, ...])
Required Parameter
VAL_EXPR
- Expression to be evaluated.
EXPR[, ...]
- Expressions to be compared with
VAL_EXPR
by separating them using commas (,
). If it matches one of them, the function returnstrue
, andfalse
otherwise.
Usage
-
Check whether the value of the user_agent field matches one of Internet Explorer, Chrome, Safari, or Firefox.
in(user_agent, "msie", "chrome", "safari", "firefox")
-
Check whether the value of the user_agent field contains a Google or Yahoo string.
in(user_agent, "*google*", "*yahoo*")
-
Check whether the level is either 6 or 7.
in(level, 6, 7)