Abs

Abs - Absolute value.

Abs only works with int and float, any other type is ignored.

Basic usage

use Jawira\Sanitizer\Filters as Sanitizer;

class Travel {
  #[Sanitizer\Abs]
  public int $km;
}

Parameters

No parameters.

Examples

Absolute value:

use Jawira\Sanitizer\Filters as Sanitizer;

class User {
  #[Sanitizer\Abs]
  public int|float $age;
}
10 → 10
-5 → 5
3.14 → 3.14
-1.5 → 1.5

See also

-