Back to Validation

NumericVal

docs/validators/NumericVal.md

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

NumericVal

  • NumericVal()

Validates whether the input is numeric.

php
v::numericVal()->assert(-12);
// Validation passes successfully

v::numericVal()->assert('135.0');
// Validation passes successfully

This validator doesn't validate if the input is a valid number, for that purpose use the Number validator.

Templates

NumericVal::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be numeric
inverted{{subject}} must not be numeric

Template placeholders

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

Categorization

  • Numbers
  • Types

Changelog

VersionDescription
3.0.0Templates changed
2.0.0Renamed from Numeric to NumericVal
0.3.9Created as Numeric

See Also