$sanitizerwords()

Given string return a new string containing only words

Available since version 3.0.195.

Usage

// basic usage
$string = $sanitizer->words($value);

// usage with all arguments
$string = $sanitizer->words($value, array $options = []);

Arguments

NameType(s)Description
$value
$options (optional)array
  • separator (string): String to use to separate words Default:' '
  • ascii (string): Only allow ASCII characters in words? Default:false
  • keepUnderscore (bool): Keep underscores as part of words? Default:false
  • keepHyphen (bool): Keep hyphenated words? Default:false
  • keepChars (array): Additional non word characters to keep Default:[]
  • maxWordLength (int): Maximum word length Default:80
  • minWordLength (int): Minimum word length Default:1
  • maxLength (int): Maximum return value length Default:1024
  • beautify (bool): Make ugly strings more pretty? This collapses and trims redundant separators Default:true

Return value

string


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.252