$sanitizer->valid() method

Is given value valid? (i.e. unchanged by given sanitizer method)

Available since version 3.0.125.


if($sanitizer->valid('abc123', 'alphanumeric')) {
 // value is valid


// basic usage
$bool = $sanitizer->valid($value);

// usage with all arguments
$bool = $sanitizer->valid($value, string $method = 'text', bool $strict = false);


valuestring, int, array, float

Value to check if valid

method (optional)string

Method name or CSV method names

strict (optional)bool

When true, sanitized value must be identical in type to the one given

Return value


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • ProcessWire 3.0.146 on the dev branch contains about 22 commits with a combination of useful upgrades and issue report resolutions, more details in this forum post: More
    22 November 2019
  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019
  • ProcessWire 3.0.144 core updates: Upgraded overrides section in the field editor, a new Inputfields JS API, and more— More
    1 November 2019

Latest news

  • ProcessWire Weekly #290
    In the 290th issue of ProcessWire Weekly we're going to introduce the latest addition to the ProDevTools module package and a third party image picker field from gebeer, check out a new site of the week, and more. Read on!
    Weekly.pw / 30 November 2019
  • New User Activity module
    Blog / 29 November 2019
  • Subscribe to weekly ProcessWire news

I just love the easy and intuitive ProcessWire API. ProcessWire rocks!” —Jens Martsch, Web developer