Skip to content

Kirby 4.5.0

in

Checks if the value exists in a list of given values

V::in($value, array $in, bool $strict = false): bool

Parameters

Name Type Default
$value * mixed
$in * array
$strict bool false

Return type

bool

In your code

if(V::in('A', ['A', 'B', 'C'])) {
  echo 'Yay, valid!';
}

In fields

fields:
  example:
    label: Example field
    type: text
    validate:
      in:
        - A
        - B
        - C