Reference

Guide

V::between()

Checks for numbers within the given range

V::between($value, $min, $max): bool

Parameters

Name Type Default Description
$value getkirby.com/docs/reference/objects/asset/alt
$min getkirby.com/docs/reference/objects/asset/alt
$max getkirby.com/docs/reference/objects/asset/alt

Return type

bool

In your code

if(V::between($input, 5, 20)) {
  echo 'Yay, valid!';
}

In fields

fields:
  example:
    label: Example field
    type: text
    validate:
      between:
        - 5
        - 20

Source code

kirby/src/Toolkit/V.php#L227