Reference

Guide

V::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 Description
$value /docs/reference/objects/file/api-url
$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

Source code

kirby/src/Toolkit/V.php#L286