Back to Validation

Even

docs/validators/Even.md

3.1.11.2 KB
Original Source
<!-- SPDX-License-Identifier: MIT SPDX-FileCopyrightText: (c) Respect Project Contributors SPDX-FileContributor: Alexandre Gomes Gaigalas <[email protected]> SPDX-FileContributor: Henrique Moody <[email protected]> SPDX-FileContributor: Paul Karikari <[email protected]> -->

Even

  • Even()

Validates whether the input is an even number or not.

php
v::intVal()->even()->assert(2);
// Validation passes successfully

Using int() before even() is a best practice.

Templates

Even::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be an even number
inverted{{subject}} must be an odd number

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Numbers

Changelog

VersionDescription
0.3.9Created

See Also