$sanitizertextArray()

Sanitize given value to array of text strings

One use case is if if the array might have objects in it and you want them converted to text for a normalized array without surprises.

Available since version 3.0.256.

Usage

// basic usage
$array = $sanitizer->textArray(mixed $value);

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

Arguments

NameType(s)Description
$valuemixed
$options (optional)array
  • verbose (bool): Convert object values to arrays (rather than class names) when possible? Default:true
  • assoc (bool): Allow associative arrays? Default:true
  • types (bool): Keep int, float and boolean types as-is rather than text/string? Default:false
  • maxItems (int): Maximum items allowed in array or 0 for no max Default:0
  • maxDepth (int): Maximum depth of nested array or 0 for no max Default:5
  • maxItemLength (int): Maximum length of any string in the array or 0 for no max Default:0
  • sanitizer (string): Sanitizer method to use on items Default:'text'
  • keySanitizer (string): Sanitizer method to use on item keys, if 'assoc' option is true Default:'auto'

Return value

array


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.257